aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2022-04-07 18:13:13 +0200
committerTomas Vondra <tomas.vondra@postgresql.org>2022-04-07 20:06:36 +0200
commit2c7ea57e56ca5f668c32d4266e0a3e45b455bef5 (patch)
treec4b80357147f2212e571dd1a4522c2b73068a783 /src/backend/parser
parentd7ab2a9a3c0a2800ab36bb48d1cc97370067777e (diff)
downloadpostgresql-2c7ea57e56ca5f668c32d4266e0a3e45b455bef5.tar.gz
postgresql-2c7ea57e56ca5f668c32d4266e0a3e45b455bef5.zip
Revert "Logical decoding of sequences"
This reverts a sequence of commits, implementing features related to logical decoding and replication of sequences: - 0da92dc530c9251735fc70b20cd004d9630a1266 - 80901b32913ffa59bf157a4d88284b2b3a7511d9 - b779d7d8fdae088d70da5ed9fcd8205035676df3 - d5ed9da41d96988d905b49bebb273a9b2d6e2915 - a180c2b34de0989269fdb819bff241a249bf5380 - 75b1521dae1ff1fde17fda2e30e591f2e5d64b6a - 2d2232933b02d9396113662e44dca5f120d6830e - 002c9dd97a0c874fd1693a570383e2dd38cd40d5 - 05843b1aa49df2ecc9b97c693b755bd1b6f856a9 The implementation has issues, mostly due to combining transactional and non-transactional behavior of sequences. It's not clear how this could be fixed, but it'll require reworking significant part of the patch. Discussion: https://postgr.es/m/95345a19-d508-63d1-860a-f5c2f41e8d40@enterprisedb.com
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y79
1 files changed, 14 insertions, 65 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 2cc92a89432..c9941d9cb4f 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -455,7 +455,7 @@ 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 pub_obj_list pub_obj_type_list
+ drop_option_list pub_obj_list
%type <node> opt_routine_body
%type <groupclause> group_clause
@@ -588,7 +588,6 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
%type <node> var_value zone_value
%type <rolespec> auth_ident RoleSpec opt_granted_by
%type <publicationobjectspec> PublicationObjSpec
-%type <node> pub_obj_type
%type <keyword> unreserved_keyword type_func_name_keyword
%type <keyword> col_name_keyword reserved_keyword
@@ -9863,10 +9862,13 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
*
* CREATE PUBLICATION FOR ALL TABLES [WITH options]
*
- * CREATE PUBLICATION FOR ALL SEQUENCES [WITH options]
- *
* CREATE PUBLICATION FOR pub_obj [, ...] [WITH options]
*
+ * pub_obj is one of:
+ *
+ * TABLE table [, ...]
+ * ALL TABLES IN SCHEMA schema [, ...]
+ *
*****************************************************************************/
CreatePublicationStmt:
@@ -9877,12 +9879,12 @@ CreatePublicationStmt:
n->options = $4;
$$ = (Node *)n;
}
- | CREATE PUBLICATION name FOR ALL pub_obj_type_list opt_definition
+ | CREATE PUBLICATION name FOR ALL TABLES opt_definition
{
CreatePublicationStmt *n = makeNode(CreatePublicationStmt);
n->pubname = $3;
n->options = $7;
- n->for_all_objects = $6;
+ n->for_all_tables = true;
$$ = (Node *)n;
}
| CREATE PUBLICATION name FOR pub_obj_list opt_definition
@@ -9932,26 +9934,6 @@ PublicationObjSpec:
$$->pubobjtype = PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA;
$$->location = @5;
}
- | SEQUENCE relation_expr
- {
- $$ = makeNode(PublicationObjSpec);
- $$->pubobjtype = PUBLICATIONOBJ_SEQUENCE;
- $$->pubtable = makeNode(PublicationTable);
- $$->pubtable->relation = $2;
- }
- | ALL SEQUENCES IN_P SCHEMA ColId
- {
- $$ = makeNode(PublicationObjSpec);
- $$->pubobjtype = PUBLICATIONOBJ_SEQUENCES_IN_SCHEMA;
- $$->name = $5;
- $$->location = @5;
- }
- | ALL SEQUENCES IN_P SCHEMA CURRENT_SCHEMA
- {
- $$ = makeNode(PublicationObjSpec);
- $$->pubobjtype = PUBLICATIONOBJ_SEQUENCES_IN_CUR_SCHEMA;
- $$->location = @5;
- }
| ColId opt_column_list OptWhereClause
{
$$ = makeNode(PublicationObjSpec);
@@ -10013,19 +9995,6 @@ pub_obj_list: PublicationObjSpec
{ $$ = lappend($1, $3); }
;
-pub_obj_type: TABLES
- { $$ = (Node *) makeString("tables"); }
- | SEQUENCES
- { $$ = (Node *) makeString("sequences"); }
- ;
-
-pub_obj_type_list: pub_obj_type
- { $$ = list_make1($1); }
- | pub_obj_type_list ',' pub_obj_type
- { $$ = lappend($1, $3); }
- ;
-
-
/*****************************************************************************
*
* ALTER PUBLICATION name SET ( options )
@@ -10036,6 +10005,11 @@ pub_obj_type_list: pub_obj_type
*
* ALTER PUBLICATION name SET pub_obj [, ...]
*
+ * pub_obj is one of:
+ *
+ * TABLE table_name [, ...]
+ * ALL TABLES IN SCHEMA schema_name [, ...]
+ *
*****************************************************************************/
AlterPublicationStmt:
@@ -18757,8 +18731,7 @@ preprocess_pubobj_list(List *pubobjspec_list, core_yyscan_t yyscanner)
if (pubobj->pubobjtype == PUBLICATIONOBJ_CONTINUATION)
pubobj->pubobjtype = prevobjtype;
- if (pubobj->pubobjtype == PUBLICATIONOBJ_TABLE ||
- pubobj->pubobjtype == PUBLICATIONOBJ_SEQUENCE)
+ if (pubobj->pubobjtype == PUBLICATIONOBJ_TABLE)
{
/* relation name or pubtable must be set for this type of object */
if (!pubobj->name && !pubobj->pubtable)
@@ -18809,30 +18782,6 @@ preprocess_pubobj_list(List *pubobjspec_list, core_yyscan_t yyscanner)
errmsg("invalid schema name at or near"),
parser_errposition(pubobj->location));
}
- else if (pubobj->pubobjtype == PUBLICATIONOBJ_SEQUENCES_IN_SCHEMA ||
- pubobj->pubobjtype == PUBLICATIONOBJ_SEQUENCES_IN_CUR_SCHEMA)
- {
- /* WHERE clause is not allowed on a schema object */
- if (pubobj->pubtable && pubobj->pubtable->whereClause)
- ereport(ERROR,
- errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("WHERE clause not allowed for schema"),
- parser_errposition(pubobj->location));
-
- /*
- * We can distinguish between the different type of schema
- * objects based on whether name and pubtable is set.
- */
- if (pubobj->name)
- pubobj->pubobjtype = PUBLICATIONOBJ_SEQUENCES_IN_SCHEMA;
- else if (!pubobj->name && !pubobj->pubtable)
- pubobj->pubobjtype = PUBLICATIONOBJ_SEQUENCES_IN_CUR_SCHEMA;
- else
- ereport(ERROR,
- errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("invalid schema name at or near"),
- parser_errposition(pubobj->location));
- }
prevobjtype = pubobj->pubobjtype;
}