Replies: 1 comment 4 replies
-
Skip the Antlr grammar for a moment. You're saying that Oracle's implementation does not align with the doc? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The
table_properties
rule is ordered in the PLSQL grammar, matching the Oracle docs:https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/CREATE-TABLE.html#GUID-F9CE0CC3-13AE-4744-A43C-EAC7A71AAAB6__I2126725
The issue is that Oracle permits specifying a variety of these table properties in arbitrary orders that do not align with the current grammar. So, for example, if LogMiner or the DBMS_METADATA package were to construct a SQL statement, it's highly likely that the order of the table's property clauses will not adhere to the grammar's order.
I see a few ways we could address this so that the grammar remains logically correct, while also being lenient to satisfy these corner cases where the Oracle database engine permits such ambiguities. The question is to what extent we want to overcomplicate the grammar to make this work.
The first is the simplest in grammar, and that is, we treat all parts of the rule as a list that can be provided in any order using
|
, so that the order can be arbitrary rather than strict as it is today. The downside to this approach is that it opens the door for the SQL to contain multiple instances of the same clause, where that may otherwise be seen as invalid. It would then be on the listeners to validate whether this use case occurs and throw an exception.The second approach is to use
locals[]
to define a series of member variables in the rule's context that are evaluated when one of thetable_properties
clauses matches, so that any future observations of such clauses throw an exception since they're only to be allowed once.I see
locals[]
used in tiny portions of the codebase, which is why I am curious what the maintainers prefer.From Debezium's perspective, we'd ideally like to be able to use as much of the upstream "as-is" as possible, as that reduces technical debt. For that to be possible, some of these rules need to adhere more to the database engine and less so to the rigid nature of the documentation.
Do any of the maintainers or users of the PL/SQL grammar have any input?
Beta Was this translation helpful? Give feedback.
All reactions