Skip to content

Commit 92ffbee

Browse files
vsai12claude
andcommitted
feat(plsql): integrate upstream rules into grammar entry points
Integrates the upstream rules into the main grammar so they are actually usable: - Add create_schema to unit_statement - Add drop_materialized_view_log to unit_statement - Add accessible_by_clause to create_package, create_function_body, create_procedure_body - Add annotations_clause to create_package, create_function_body, create_procedure_body - Add default_collation_clause to create_package, create_function_body, create_procedure_body - Add compound_trigger_block to trigger_body - Integrate pipelined_using_clause into create_function_body for polymorphic table functions (ROW/TABLE POLYMORPHIC) Test files added from upstream: - examples/create_function03.sql (polymorphic pipelined function) - examples/drop_materialized_view_log.sql All 373 tests pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1cdc452 commit 92ffbee

4 files changed

Lines changed: 26693 additions & 26068 deletions

File tree

plsql/PlSqlParser.g4

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ unit_statement
108108
| create_restore_point
109109
| create_role
110110
| create_rollback_segment
111+
| create_schema
111112
| create_sequence
112113
| create_spfile
113114
| create_synonym
@@ -139,6 +140,7 @@ unit_statement
139140
| drop_library
140141
| drop_lockdown_profile
141142
| drop_materialized_view
143+
| drop_materialized_view_log
142144
| drop_materialized_zonemap
143145
| drop_operator
144146
| drop_outline
@@ -478,9 +480,10 @@ match_string
478480

479481
create_function_body
480482
: CREATE (OR REPLACE)? FUNCTION function_name (LEFT_PAREN parameter (COMMA parameter)* RIGHT_PAREN)?
481-
RETURN type_spec (invoker_rights_clause | parallel_enable_clause | result_cache_clause | DETERMINISTIC)*
483+
RETURN type_spec (invoker_rights_clause | accessible_by_clause | parallel_enable_clause | result_cache_clause | DETERMINISTIC | default_collation_clause | annotations_clause)*
482484
((PIPELINED? (IS | AS) (DECLARE? seq_of_declare_specs? body | call_spec))
483-
| (PIPELINED | AGGREGATE) USING implementation_type_name
485+
| pipelined_using_clause
486+
| AGGREGATE USING implementation_type_name
484487
| sql_macro_body
485488
) SEMICOLON
486489
;
@@ -594,7 +597,9 @@ alter_package
594597
;
595598

596599
create_package
597-
: CREATE (OR REPLACE)? PACKAGE (schema_object_name PERIOD)? package_name invoker_rights_clause? (IS | AS) package_obj_spec* END package_name? SEMICOLON
600+
: CREATE (OR REPLACE)? PACKAGE (schema_object_name PERIOD)? package_name
601+
(invoker_rights_clause | accessible_by_clause | default_collation_clause | annotations_clause)*
602+
(IS | AS) package_obj_spec* END package_name? SEMICOLON
598603
;
599604

600605
create_package_body
@@ -674,7 +679,7 @@ procedure_body
674679

675680
create_procedure_body
676681
: CREATE (OR REPLACE)? PROCEDURE procedure_name (LEFT_PAREN parameter (COMMA parameter)* RIGHT_PAREN)?
677-
invoker_rights_clause? (IS | AS)
682+
(invoker_rights_clause | accessible_by_clause | default_collation_clause | annotations_clause)* (IS | AS)
678683
(DECLARE? seq_of_declare_specs? body | call_spec | EXTERNAL) SEMICOLON
679684
;
680685

@@ -773,7 +778,7 @@ non_dml_trigger
773778
;
774779

775780
trigger_body
776-
: COMPOUND TRIGGER
781+
: compound_trigger_block
777782
| CALL identifier
778783
| trigger_block
779784
;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CREATE FUNCTION process_table(tab TABLE)
2+
RETURN TABLE PIPELINED ROW POLYMORPHIC USING process_table_pkg;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DROP MATERIALIZED VIEW LOG ON MY_SCHEMA.MY_TABLE;
2+
3+
DROP MATERIALIZED VIEW LOG IF EXISTS ON MY_SCHEMA.MY_TABLE;

0 commit comments

Comments
 (0)