fix: Oracle PL/SQL TYPE ... IS RECORD parsing in package body#6629
Open
daguimu wants to merge 1 commit intoalibaba:masterfrom
Open
fix: Oracle PL/SQL TYPE ... IS RECORD parsing in package body#6629daguimu wants to merge 1 commit intoalibaba:masterfrom
daguimu wants to merge 1 commit intoalibaba:masterfrom
Conversation
Add RECORD type support to the PL/SQL declaration parser that previously only handled REF CURSOR, TABLE OF, and VARRAY after TYPE ... IS. The parser now correctly parses TYPE ... IS RECORD(field1 type1, field2 type2) declarations inside package bodies, procedures, and DECLARE blocks. The implementation follows the same pattern as the existing RECORD parsing at line ~2940 in OracleStatementParser. Fixes alibaba#6589 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Oracle PL/SQL parser throws
ParserException: TODOwhen encounteringTYPE ... IS RECORD(...)declarations inside package bodies, procedures, or DECLARE blocks.Root cause: In
OracleStatementParser(line ~2129), theTYPE ... IShandler only supportedREF CURSOR,TABLE OF, andVARRAY—RECORDwas missing, falling through to athrow new ParserException("TODO").Fix
Add
RECORDtype parsing to the PL/SQL declaration section, following the same implementation pattern already used at line ~2940 in the same file. The fix parsesRECORD(field1 type1, field2 type2, ...)usingSQLRecordDataTypeandparseColumn()which already exist in the codebase.Tests Added
6 test cases in
Issue6589.java:test_type_is_record_in_package_body_procedure— RECORD type inside a procedure in a package bodytest_type_is_record_in_declare_block— RECORD type in a standalone DECLARE blocktest_type_is_record_multiple_fields— RECORD with 4 fields of different typestest_ref_cursor_still_works— regression: REF CURSOR still workstest_table_of_still_works— regression: TABLE OF still workstest_package_spec_and_body_with_record— package spec + body with/separatorAll 15 existing Oracle issue tests pass.
Note
The original issue's full SQL file also uses
BULK COLLECT INTOand other advanced PL/SQL features that remain unsupported. This PR addresses theTYPE IS RECORDparsing specifically.Fixes #6589