@@ -1153,11 +1153,11 @@ func (u *sqlSymUnion) vacuumTableAndColsList() tree.VacuumTableAndColsList {
11531153%type <str> table_alias_name constraint_name target_name opt_from_ref_table
11541154%type <*tree.UnresolvedObjectName> collation_name
11551155%type <str> db_object_name_component
1156- %type <*tree.UnresolvedObjectName> table_name standalone_index_name sequence_name type_name routine_name aggregate_name
1156+ %type <*tree.UnresolvedObjectName> table_name standalone_index_name sequence_name type_name routine_name aggregate_name partition_name
11571157%type <*tree.UnresolvedObjectName> view_name db_object_name simple_db_object_name complex_db_object_name opt_collate
11581158%type <*tree.UnresolvedObjectName> db_object_name_no_keywords simple_db_object_name_no_keywords complex_db_object_name_no_keywords
11591159%type <[]*tree.UnresolvedObjectName> type_name_list sequence_name_list
1160- %type <str> schema_name opt_schema_name opt_schema opt_version tablespace_name partition_name
1160+ %type <str> schema_name opt_schema_name opt_schema opt_version tablespace_name
11611161%type <[]string> schema_name_list role_spec_list opt_role_list opt_owned_by_list
11621162%type <*tree.UnresolvedName> table_pattern complex_table_pattern
11631163%type <*tree.UnresolvedName> column_path prefixed_column_path column_path_with_star
@@ -1201,7 +1201,7 @@ func (u *sqlSymUnion) vacuumTableAndColsList() tree.VacuumTableAndColsList {
12011201%type <[]*tree.Order> sortby_list
12021202%type <tree.IndexParams> constraint_index_params
12031203%type <tree.IndexElemList> index_params index_params_name_only opt_index_params_name_only opt_include_index_cols partition_index_params exclude_elems
1204- %type <tree.NameList> name_list opt_name_list privilege_list
1204+ %type <tree.NameList> name_list opt_name_list privilege_list sconst_as_name_list
12051205%type <[]int32> opt_array_bounds
12061206%type <tree.From> from_clause
12071207%type <tree.TableExprs> from_list opt_from_list
@@ -4611,6 +4611,10 @@ begin_end_block:
46114611 {
46124612 $$ .val = &tree.BeginEndBlock{Statements: $3 .stmts()}
46134613 }
4614+ | BEGIN ATOMIC RETURN a_expr ' ;' END
4615+ {
4616+ $$ .val = &tree.BeginEndBlock{Statements: []tree.Statement{&tree.Return{Expr: $4 .expr()}}}
4617+ }
46144618
46154619opt_schema :
46164620 /* EMPTY */
@@ -8726,6 +8730,44 @@ create_trigger_stmt:
87268730 Args: $20 .nameList(),
87278731 }
87288732 }
8733+ | CREATE opt_constraint TRIGGER trigger_name trigger_time trigger_events ON table_name opt_from_ref_table
8734+ opt_trigger_deferrable_mode opt_trigger_relations opt_for_each opt_when EXECUTE function_or_procedure routine_name ' (' sconst_as_name_list ' )'
8735+ {
8736+ $$ .val = &tree.CreateTrigger{
8737+ Replace: false ,
8738+ Constraint: $2 .bool (),
8739+ Name: tree.Name($4 ),
8740+ Time: $5 .triggerTime(),
8741+ Events: $6 .triggerEvents(),
8742+ OnTable: $8 .unresolvedObjectName().ToTableName(),
8743+ RefTable: tree.Name($9 ),
8744+ Deferrable: $10 .triggerDeferrableMode(),
8745+ Relations: $11 .triggerRelations(),
8746+ ForEachRow: $12 .bool (),
8747+ When: $13 .expr(),
8748+ FuncName: $16 .unresolvedObjectName(),
8749+ Args: $18 .nameList(),
8750+ }
8751+ }
8752+ | CREATE OR REPLACE opt_constraint TRIGGER trigger_name trigger_time trigger_events ON table_name opt_from_ref_table
8753+ opt_trigger_deferrable_mode opt_trigger_relations opt_for_each opt_when EXECUTE function_or_procedure routine_name ' (' sconst_as_name_list ' )'
8754+ {
8755+ $$ .val = &tree.CreateTrigger{
8756+ Replace: true ,
8757+ Constraint: $4 .bool (),
8758+ Name: tree.Name($6 ),
8759+ Time: $7 .triggerTime(),
8760+ Events: $8 .triggerEvents(),
8761+ OnTable: $10 .unresolvedObjectName().ToTableName(),
8762+ RefTable: tree.Name($11 ),
8763+ Deferrable: $12 .triggerDeferrableMode(),
8764+ Relations: $13 .triggerRelations(),
8765+ ForEachRow: $14 .bool (),
8766+ When: $15 .expr(),
8767+ FuncName: $18 .unresolvedObjectName(),
8768+ Args: $20 .nameList(),
8769+ }
8770+ }
87298771
87308772function_or_procedure :
87318773 FUNCTION
@@ -9573,28 +9615,28 @@ alter_table_all_in_tablespace_stmt:
95739615 }
95749616
95759617alter_table_parition_stmt :
9576- ALTER TABLE table_name ATTACH PARTITION partition_name partition_of
9618+ ALTER TABLE relation_expr ATTACH PARTITION partition_name partition_of
95779619 {
95789620 $$ .val = &tree.AlterTablePartition{
9579- Name: $3 .unresolvedObjectName(), IfExists: false , Partition: tree.Name( $6 ), Spec: $7 .partitionBoundSpec(),
9621+ Name: $3 .unresolvedObjectName(), IfExists: false , Partition: $6 .unresolvedObjectName( ), Spec: $7 .partitionBoundSpec(),
95809622 }
95819623 }
9582- | ALTER TABLE IF EXISTS table_name ATTACH PARTITION partition_name partition_of
9624+ | ALTER TABLE IF EXISTS relation_expr ATTACH PARTITION partition_name partition_of
95839625 {
95849626 $$ .val = &tree.AlterTablePartition{
9585- Name: $5 .unresolvedObjectName(), IfExists: true , Partition: tree.Name( $8 ), Spec: $9 .partitionBoundSpec(),
9627+ Name: $5 .unresolvedObjectName(), IfExists: true , Partition: $8 .unresolvedObjectName( ), Spec: $9 .partitionBoundSpec(),
95869628 }
95879629 }
9588- | ALTER TABLE table_name DETACH PARTITION partition_name detach_partition_type
9630+ | ALTER TABLE relation_expr DETACH PARTITION partition_name detach_partition_type
95899631 {
95909632 $$ .val = &tree.AlterTablePartition{
9591- Name: $3 .unresolvedObjectName(), IfExists: false , Partition: tree.Name( $6 ), IsDetach: true , DetachType: $7 .detachPartition(),
9633+ Name: $3 .unresolvedObjectName(), IfExists: false , Partition: $6 .unresolvedObjectName( ), IsDetach: true , DetachType: $7 .detachPartition(),
95929634 }
95939635 }
9594- | ALTER TABLE IF EXISTS table_name DETACH PARTITION partition_name detach_partition_type
9636+ | ALTER TABLE IF EXISTS relation_expr DETACH PARTITION partition_name detach_partition_type
95959637 {
95969638 $$ .val = &tree.AlterTablePartition{
9597- Name: $5 .unresolvedObjectName(), IfExists: true , Partition: tree.Name( $8 ), IsDetach: true , DetachType: $9 .detachPartition(),
9639+ Name: $5 .unresolvedObjectName(), IfExists: true , Partition: $8 .unresolvedObjectName( ), IsDetach: true , DetachType: $9 .detachPartition(),
95989640 }
95999641 }
96009642
@@ -14223,6 +14265,16 @@ name_list:
1422314265 $$ .val = append($1 .nameList(), tree.Name($3 ))
1422414266 }
1422514267
14268+ sconst_as_name_list:
14269+ SCONST
14270+ {
14271+ $$ .val = tree.NameList{tree.Name($1 )}
14272+ }
14273+ | sconst_as_name_list ' ,' SCONST
14274+ {
14275+ $$ .val = append($1 .nameList(), tree.Name($3 ))
14276+ }
14277+
1422614278sequence_name_list:
1422714279 sequence_name
1422814280 {
@@ -14421,7 +14473,7 @@ cursor_name: name
1442114473
1442214474tablespace_name: name
1442314475
14424- partition_name: name
14476+ partition_name: db_object_name
1442514477
1442614478routine_name: db_object_name
1442714479
0 commit comments