Skip to content

Commit c2e1b86

Browse files
committed
refactor(plsql): drop redundant list_partition_value_item tuple rule
Address review feedback: the parenthesized-tuple alternative in list_partition_value was unreachable because expression -> atom already matches LEFT_PAREN expressions RIGHT_PAREN with identical semantics. Remove the dedicated tuple layer and rely on expression for tuple form in multi-column LIST partitioning — same parse coverage with simpler AST shape. Comments on range_partition_value and list_partition_value explain why their inner alternatives stay (clarity of intended terminals).
1 parent 22ab06d commit c2e1b86

6 files changed

Lines changed: 27741 additions & 28047 deletions

plsql/PlSqlParser.g4

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3707,6 +3707,8 @@ range_values_clause
37073707
: VALUES LESS THAN LEFT_PAREN range_partition_value (COMMA range_partition_value)* RIGHT_PAREN
37083708
;
37093709

3710+
// expression already covers MAXVALUE via constant_without_variable; kept as an explicit
3711+
// alternative purely for clarity — the intended terminals in this context are expression or MAXVALUE.
37103712
range_partition_value
37113713
: expression
37123714
| MAXVALUE
@@ -3716,16 +3718,14 @@ list_values_clause
37163718
: VALUES LEFT_PAREN (list_partition_value (COMMA list_partition_value)* | DEFAULT) RIGHT_PAREN
37173719
;
37183720

3721+
// expression already covers NULL (and, pragmatically, DEFAULT) via constant/regular_id;
3722+
// semantic validity of `DEFAULT` mixed with other values is checked by the server,
3723+
// matching how other SQL grammars in this repo over-accept at the parser level.
3724+
// Tuple form for multi-column LIST partitioning is handled by expression -> atom
3725+
// (`LEFT_PAREN expressions RIGHT_PAREN`), so no dedicated tuple rule is needed.
37193726
list_partition_value
37203727
: expression
37213728
| NULL_
3722-
| LEFT_PAREN list_partition_value_item (COMMA list_partition_value_item)* RIGHT_PAREN
3723-
;
3724-
3725-
list_partition_value_item
3726-
: expression
3727-
| NULL_
3728-
| DEFAULT
37293729
;
37303730

37313731
table_partition_description

0 commit comments

Comments
 (0)