Skip to content

Conversation

@vsai12
Copy link
Contributor

@vsai12 vsai12 commented Jan 12, 2026

Summary

  • Add 51 lexer tokens and 20 parser rules from upstream antlr/grammars-v4
  • Preserve all existing Bytebase customizations (BYT-8268)
  • Fix sequence keywords for Oracle 19C+ compatibility
  • All 371 tests pass with no regressions

New Capabilities

  • Oracle 21c+ annotations (ANNOTATIONS clause)
  • CREATE SCHEMA statement
  • DROP MATERIALIZED VIEW LOG statement
  • Compound triggers (COMPOUND TRIGGER)
  • MOVE PARTITION / RENAME PARTITION operations
  • SQL%BULK_ROWCOUNT / SQL%BULK_EXCEPTIONS expressions
  • Preprocessor directives ($IF, $ERROR, $ELSIF, etc.)
  • ACCESSIBLE BY clause for package visibility
  • PIPELINED USING clause
  • DEFAULT COLLATION clause

Not Included (Future Work)

The following 63 upstream rules were not added due to conflicts or complexity:

  • External table support (17 rules)
  • Case expression refactoring (conflicts with existing)
  • WITH clause refactoring (conflicts with existing)

These can be added incrementally as customer needs arise.

Test plan

  • Run make build - passes
  • Run make test - 371/371 tests pass
  • Verify no regressions in existing test cases

🤖 Generated with Claude Code

Add 51 lexer tokens and 20 parser rules from upstream for enhanced
Oracle support while preserving all existing Bytebase customizations.

New capabilities:
- Oracle 21c+ annotations (ANNOTATIONS clause)
- CREATE SCHEMA statement
- DROP MATERIALIZED VIEW LOG statement
- Compound triggers (COMPOUND TRIGGER)
- MOVE PARTITION / RENAME PARTITION operations
- SQL%BULK_ROWCOUNT / SQL%BULK_EXCEPTIONS expressions
- Preprocessor directives ($IF, $ERROR, $ELSIF, etc.)
- ACCESSIBLE BY clause for package visibility
- PIPELINED USING clause
- DEFAULT COLLATION clause

Also fixes:
- Sequence keywords for Oracle 19C+ (NOKEEP, NOSCALE, GLOBAL, etc.)
- Extra semicolon in create_type.sql test file

All 371 tests pass with no regressions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vsai12 vsai12 requested a review from h3n4l January 12, 2026 23:20
…port

Adds 28 additional parser rules from upstream:

C External Call Support:
- c_external_parameter, c_property

Analytic Views:
- hierarchies_clause, filter_clause, filter_clauses
- subav_clause, subav_factoring_clause
- add_calc_meas_clause, add_calcs_clause
- aggregate_clause

Utility Rules:
- parallel_instances_clause, overriding_procedure_spec
- assignable_element, connection_qualifier, local_link_name
- by_user_for_statistics_clause, unary_logical_operation
- variable_or_collection, collection_expression
- virtual_column_expression

Partition Values:
- index_partitioning_values_list, range_values_list

SQL*Plus:
- clear_command, start_command, sql_plus_command_no_semicolon

Other:
- expressions_, string_delimiter, system_actions

All 371 tests pass.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vsai12 vsai12 marked this pull request as draft January 12, 2026 23:32
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>
@vsai12 vsai12 marked this pull request as ready for review January 13, 2026 00:07
Move LEFT_CURLY_PAREN and RIGHT_CURLY_PAREN to be adjacent to
LEFT_BRACKET/RIGHT_BRACKET and LEFT_PAREN/RIGHT_PAREN for easier
navigation and consistency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vsai12 vsai12 force-pushed the feat/plsql-grammar-sync-upstream branch from ea71aee to 1f0aff8 Compare January 13, 2026 00:30
Copy link
Member

@h3n4l h3n4l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@h3n4l h3n4l merged commit 9ed369a into main Jan 13, 2026
5 checks passed
@h3n4l h3n4l deleted the feat/plsql-grammar-sync-upstream branch January 13, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants