mirror of
https://github.com/postgres/postgres.git
synced 2025-08-31 17:02:12 +03:00
Add PublicationTable and PublicationRelInfo structs
These encapsulate a relation when referred from replication DDL. Currently they don't do anything useful (they're just wrappers around RangeVar and Relation respectively) but in the future they'll be used to carry column lists. Extracted from a larger patch by Rahila Syed. Author: Rahila Syed <rahilasyed90@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CAH2L28vddB_NFdRVpuyRBJEBWjz4BSyTB=_ektNRH8NJ1jf95g@mail.gmail.com
This commit is contained in:
@@ -426,14 +426,14 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
|
||||
transform_element_list transform_type_list
|
||||
TriggerTransitions TriggerReferencing
|
||||
vacuum_relation_list opt_vacuum_relation_list
|
||||
drop_option_list
|
||||
drop_option_list publication_table_list
|
||||
|
||||
%type <node> opt_routine_body
|
||||
%type <groupclause> group_clause
|
||||
%type <list> group_by_list
|
||||
%type <node> group_by_item empty_grouping_set rollup_clause cube_clause
|
||||
%type <node> grouping_sets_clause
|
||||
%type <node> opt_publication_for_tables publication_for_tables
|
||||
%type <node> opt_publication_for_tables publication_for_tables publication_table
|
||||
|
||||
%type <list> opt_fdw_options fdw_options
|
||||
%type <defelt> fdw_option
|
||||
@@ -9620,7 +9620,7 @@ opt_publication_for_tables:
|
||||
;
|
||||
|
||||
publication_for_tables:
|
||||
FOR TABLE relation_expr_list
|
||||
FOR TABLE publication_table_list
|
||||
{
|
||||
$$ = (Node *) $3;
|
||||
}
|
||||
@@ -9630,6 +9630,20 @@ publication_for_tables:
|
||||
}
|
||||
;
|
||||
|
||||
publication_table_list:
|
||||
publication_table
|
||||
{ $$ = list_make1($1); }
|
||||
| publication_table_list ',' publication_table
|
||||
{ $$ = lappend($1, $3); }
|
||||
;
|
||||
|
||||
publication_table: relation_expr
|
||||
{
|
||||
PublicationTable *n = makeNode(PublicationTable);
|
||||
n->relation = $1;
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
;
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
@@ -9651,7 +9665,7 @@ AlterPublicationStmt:
|
||||
n->options = $5;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ALTER PUBLICATION name ADD_P TABLE relation_expr_list
|
||||
| ALTER PUBLICATION name ADD_P TABLE publication_table_list
|
||||
{
|
||||
AlterPublicationStmt *n = makeNode(AlterPublicationStmt);
|
||||
n->pubname = $3;
|
||||
@@ -9659,7 +9673,7 @@ AlterPublicationStmt:
|
||||
n->tableAction = DEFELEM_ADD;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ALTER PUBLICATION name SET TABLE relation_expr_list
|
||||
| ALTER PUBLICATION name SET TABLE publication_table_list
|
||||
{
|
||||
AlterPublicationStmt *n = makeNode(AlterPublicationStmt);
|
||||
n->pubname = $3;
|
||||
@@ -9667,7 +9681,7 @@ AlterPublicationStmt:
|
||||
n->tableAction = DEFELEM_SET;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ALTER PUBLICATION name DROP TABLE relation_expr_list
|
||||
| ALTER PUBLICATION name DROP TABLE publication_table_list
|
||||
{
|
||||
AlterPublicationStmt *n = makeNode(AlterPublicationStmt);
|
||||
n->pubname = $3;
|
||||
|
Reference in New Issue
Block a user