Skip to content

Commit c4325ce

Browse files
committed
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
1 parent c2bd1fe commit c4325ce

File tree

1 file changed

+21
-32
lines changed

1 file changed

+21
-32
lines changed

src/backend/parser/gram.y

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
259259
AlterFdwStmt AlterForeignServerStmt AlterGroupStmt
260260
AlterObjectDependsStmt AlterObjectSchemaStmt AlterOwnerStmt
261261
AlterOperatorStmt AlterTypeStmt AlterSeqStmt AlterSystemStmt AlterTableStmt
262-
AlterTblSpcStmt AlterExtensionStmt AlterExtensionContentsStmt AlterForeignTableStmt
262+
AlterTblSpcStmt AlterExtensionStmt AlterExtensionContentsStmt
263263
AlterCompositeTypeStmt AlterUserMappingStmt
264264
AlterRoleStmt AlterRoleSetStmt AlterPolicyStmt AlterStatsStmt
265265
AlterDefaultPrivilegesStmt DefACLAction
@@ -850,7 +850,6 @@ stmt :
850850
| AlterExtensionContentsStmt
851851
| AlterFdwStmt
852852
| AlterForeignServerStmt
853-
| AlterForeignTableStmt
854853
| AlterFunctionStmt
855854
| AlterGroupStmt
856855
| AlterObjectDependsStmt
@@ -1836,9 +1835,9 @@ DiscardStmt:
18361835

18371836
/*****************************************************************************
18381837
*
1839-
* ALTER [ TABLE | INDEX | SEQUENCE | VIEW | MATERIALIZED VIEW ] variations
1838+
* ALTER [ TABLE | INDEX | SEQUENCE | VIEW | MATERIALIZED VIEW | FOREIGN TABLE ] variations
18401839
*
1841-
* Note: we accept all subcommands for each of the five variants, and sort
1840+
* Note: we accept all subcommands for each of the variants, and sort
18421841
* out what's really legal at execution time.
18431842
*****************************************************************************/
18441843

@@ -2026,6 +2025,24 @@ AlterTableStmt:
20262025
n->nowait = $14;
20272026
$$ = (Node *)n;
20282027
}
2028+
| ALTER FOREIGN TABLE relation_expr alter_table_cmds
2029+
{
2030+
AlterTableStmt *n = makeNode(AlterTableStmt);
2031+
n->relation = $4;
2032+
n->cmds = $5;
2033+
n->relkind = OBJECT_FOREIGN_TABLE;
2034+
n->missing_ok = false;
2035+
$$ = (Node *)n;
2036+
}
2037+
| ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds
2038+
{
2039+
AlterTableStmt *n = makeNode(AlterTableStmt);
2040+
n->relation = $6;
2041+
n->cmds = $7;
2042+
n->relkind = OBJECT_FOREIGN_TABLE;
2043+
n->missing_ok = true;
2044+
$$ = (Node *)n;
2045+
}
20292046
;
20302047

20312048
alter_table_cmds:
@@ -5111,34 +5128,6 @@ CreateForeignTableStmt:
51115128
}
51125129
;
51135130

5114-
/*****************************************************************************
5115-
*
5116-
* QUERY:
5117-
* ALTER FOREIGN TABLE relname [...]
5118-
*
5119-
*****************************************************************************/
5120-
5121-
AlterForeignTableStmt:
5122-
ALTER FOREIGN TABLE relation_expr alter_table_cmds
5123-
{
5124-
AlterTableStmt *n = makeNode(AlterTableStmt);
5125-
n->relation = $4;
5126-
n->cmds = $5;
5127-
n->relkind = OBJECT_FOREIGN_TABLE;
5128-
n->missing_ok = false;
5129-
$$ = (Node *)n;
5130-
}
5131-
| ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds
5132-
{
5133-
AlterTableStmt *n = makeNode(AlterTableStmt);
5134-
n->relation = $6;
5135-
n->cmds = $7;
5136-
n->relkind = OBJECT_FOREIGN_TABLE;
5137-
n->missing_ok = true;
5138-
$$ = (Node *)n;
5139-
}
5140-
;
5141-
51425131
/*****************************************************************************
51435132
*
51445133
* QUERY:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy