aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2020-06-11 08:21:24 +0200
committerPeter Eisentraut <peter@eisentraut.org>2020-06-11 08:21:24 +0200
commitc4325cefba512772efc108baf8ef7182c3833716 (patch)
treed9806174e7c36140519d87a2fe98a2737bd45fa4 /src
parentc2bd1fec32ab5407a3675272af1a06f425cb5161 (diff)
downloadpostgresql-c4325cefba512772efc108baf8ef7182c3833716.tar.gz
postgresql-c4325cefba512772efc108baf8ef7182c3833716.zip
Fold AlterForeignTableStmt into AlterTableStmt
All other relation types are handled by AlterTableStmt, so it's unnecessary to make a different statement for foreign tables. Discussion: https://www.postgresql.org/message-id/flat/163c00a5-f634-ca52-fc7c-0e53deda8735%402ndquadrant.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/parser/gram.y53
1 files changed, 21 insertions, 32 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 9ed640c379b..6797d550cd0 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -259,7 +259,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
AlterFdwStmt AlterForeignServerStmt AlterGroupStmt
AlterObjectDependsStmt AlterObjectSchemaStmt AlterOwnerStmt
AlterOperatorStmt AlterTypeStmt AlterSeqStmt AlterSystemStmt AlterTableStmt
- AlterTblSpcStmt AlterExtensionStmt AlterExtensionContentsStmt AlterForeignTableStmt
+ AlterTblSpcStmt AlterExtensionStmt AlterExtensionContentsStmt
AlterCompositeTypeStmt AlterUserMappingStmt
AlterRoleStmt AlterRoleSetStmt AlterPolicyStmt AlterStatsStmt
AlterDefaultPrivilegesStmt DefACLAction
@@ -850,7 +850,6 @@ stmt :
| AlterExtensionContentsStmt
| AlterFdwStmt
| AlterForeignServerStmt
- | AlterForeignTableStmt
| AlterFunctionStmt
| AlterGroupStmt
| AlterObjectDependsStmt
@@ -1836,9 +1835,9 @@ DiscardStmt:
/*****************************************************************************
*
- * ALTER [ TABLE | INDEX | SEQUENCE | VIEW | MATERIALIZED VIEW ] variations
+ * ALTER [ TABLE | INDEX | SEQUENCE | VIEW | MATERIALIZED VIEW | FOREIGN TABLE ] variations
*
- * Note: we accept all subcommands for each of the five variants, and sort
+ * Note: we accept all subcommands for each of the variants, and sort
* out what's really legal at execution time.
*****************************************************************************/
@@ -2026,6 +2025,24 @@ AlterTableStmt:
n->nowait = $14;
$$ = (Node *)n;
}
+ | ALTER FOREIGN TABLE relation_expr alter_table_cmds
+ {
+ AlterTableStmt *n = makeNode(AlterTableStmt);
+ n->relation = $4;
+ n->cmds = $5;
+ n->relkind = OBJECT_FOREIGN_TABLE;
+ n->missing_ok = false;
+ $$ = (Node *)n;
+ }
+ | ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds
+ {
+ AlterTableStmt *n = makeNode(AlterTableStmt);
+ n->relation = $6;
+ n->cmds = $7;
+ n->relkind = OBJECT_FOREIGN_TABLE;
+ n->missing_ok = true;
+ $$ = (Node *)n;
+ }
;
alter_table_cmds:
@@ -5114,34 +5131,6 @@ CreateForeignTableStmt:
/*****************************************************************************
*
* QUERY:
- * ALTER FOREIGN TABLE relname [...]
- *
- *****************************************************************************/
-
-AlterForeignTableStmt:
- ALTER FOREIGN TABLE relation_expr alter_table_cmds
- {
- AlterTableStmt *n = makeNode(AlterTableStmt);
- n->relation = $4;
- n->cmds = $5;
- n->relkind = OBJECT_FOREIGN_TABLE;
- n->missing_ok = false;
- $$ = (Node *)n;
- }
- | ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds
- {
- AlterTableStmt *n = makeNode(AlterTableStmt);
- n->relation = $6;
- n->cmds = $7;
- n->relkind = OBJECT_FOREIGN_TABLE;
- n->missing_ok = true;
- $$ = (Node *)n;
- }
- ;
-
-/*****************************************************************************
- *
- * QUERY:
* IMPORT FOREIGN SCHEMA remote_schema
* [ { LIMIT TO | EXCEPT } ( table_list ) ]
* FROM SERVER server_name INTO local_schema [ OPTIONS (...) ]