Skip to content

feat(postgresql): remove mulit partitionboundspec rule #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions src/grammar/postgresql/PostgreSqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,7 @@ discardstmt
altertablestmt
: KW_ALTER KW_TABLE opt_if_exists? relation_expr (alter_table_cmds | partition_cmd)
| KW_ALTER KW_TABLE KW_ALL KW_IN opttablespace (KW_OWNED KW_BY role_list)? KW_SET KW_TABLESPACE tablespace_name_create KW_NOWAIT?
| KW_ALTER KW_TABLE opt_if_exists? table_name index_partition_cmd (
KW_FOR KW_VALUES partition_bound_spec
| KW_DEFAULT
)
| KW_ALTER KW_TABLE opt_if_exists? table_name index_partition_cmd partitionboundspec
| KW_ALTER KW_TABLE opt_if_exists? table_name KW_DETACH KW_PARTITION qualified_name (
KW_CONCURRENTLY
| KW_FINALIZE
Expand All @@ -429,26 +426,6 @@ alter_table_cmds
: alter_table_cmd (COMMA alter_table_cmd)*
;

partition_bound_spec
: KW_IN execute_param_clause
| KW_FROM partition_bound_cluase KW_TO partition_bound_cluase
| KW_WITH partition_with_cluase
;

partition_bound_cluase
: OPEN_PAREN partition_bound_choose (COMMA partition_bound_choose)* CLOSE_PAREN
;

partition_bound_choose
: execute_param_clause
| KW_MINVALUE
| KW_MAXVALUE
;

partition_with_cluase
: OPEN_PAREN KW_MODULUS numericonly COMMA KW_REMAINDER numericonly CLOSE_PAREN
;

partition_cmd
: index_partition_cmd partitionboundspec
| KW_DETACH KW_PARTITION qualified_name
Expand Down Expand Up @@ -526,12 +503,22 @@ reloption_elem
;

partitionboundspec
: KW_FOR KW_VALUES KW_WITH OPEN_PAREN KW_MODULUS Integral COMMA KW_REMAINDER Integral CLOSE_PAREN
: KW_FOR KW_VALUES KW_WITH OPEN_PAREN KW_MODULUS numericonly COMMA KW_REMAINDER numericonly CLOSE_PAREN
| KW_FOR KW_VALUES KW_IN execute_param_clause
| KW_FOR KW_VALUES KW_FROM execute_param_clause KW_TO execute_param_clause
| KW_FOR KW_VALUES KW_FROM partitionboundexpr KW_TO partitionboundexpr
| KW_DEFAULT
;

partitionboundexpr
: OPEN_PAREN partitionboundchoose (COMMA partitionboundchoose)* CLOSE_PAREN
;

partitionboundchoose
: expr_list
| KW_MINVALUE
| KW_MAXVALUE
;

altercompositetypestmt
: KW_ALTER KW_TYPE any_name alter_type_cmd (COMMA alter_type_cmd)*
;
Expand Down
8 changes: 3 additions & 5 deletions src/lib/postgresql/PostgreSqlParser.interp

Large diffs are not rendered by default.

Loading