aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_utilcmd.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2020-07-11 13:32:28 +0900
committerMichael Paquier <michael@paquier.xyz>2020-07-11 13:32:28 +0900
commitcc35d8933a211d9965eb1c1d2749a903d5735db2 (patch)
treeaa94cde941781ec163a7549ae20ae53cfdea72b6 /src/backend/parser/parse_utilcmd.c
parentdf646509f371069c65f84309eb5749642e8650b3 (diff)
downloadpostgresql-cc35d8933a211d9965eb1c1d2749a903d5735db2.tar.gz
postgresql-cc35d8933a211d9965eb1c1d2749a903d5735db2.zip
Rename field "relkind" to "objtype" for CTAS and ALTER TABLE nodes
"relkind" normally refers to the char field from pg_class. However, in the parse nodes AlterTableStmt and CreateTableAsStmt, "relkind" was used for a field of type enum ObjectType, that could refer to other object types than those possible for a relkind. Such fields being usually named "objtype", switch the name in both structures to make things more consistent. Note that this led to some confusion in functions that also operate on a RangeTableEntry object, which also has a field named "relkind". This naming goes back to commit 09d4e96, where only OBJECT_TABLE and OBJECT_INDEX were used. This got extended later to use as well OBJECT_TYPE with e440e12, not really a relation kind. Author: Mark Dilger Reviewed-by: Daniel Gustafsson, Álvaro Herrera, Michael Paquier Discussion: https://postgr.es/m/609181AE-E399-47C7-9221-856E0F96BF93@enterprisedb.com
Diffstat (limited to 'src/backend/parser/parse_utilcmd.c')
-rw-r--r--src/backend/parser/parse_utilcmd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 0e4caa6ad47..25abc544fc7 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -829,7 +829,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
stmt = makeNode(AlterTableStmt);
stmt->relation = cxt->relation;
stmt->cmds = NIL;
- stmt->relkind = OBJECT_FOREIGN_TABLE;
+ stmt->objtype = OBJECT_FOREIGN_TABLE;
stmt->cmds = lappend(stmt->cmds, cmd);
cxt->alist = lappend(cxt->alist, stmt);
@@ -2508,7 +2508,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
alterstmt->relation = copyObject(cxt->relation);
alterstmt->cmds = notnullcmds;
- alterstmt->relkind = OBJECT_TABLE;
+ alterstmt->objtype = OBJECT_TABLE;
alterstmt->missing_ok = false;
cxt->alist = lappend(cxt->alist, alterstmt);
@@ -2610,7 +2610,7 @@ transformFKConstraints(CreateStmtContext *cxt,
alterstmt->relation = cxt->relation;
alterstmt->cmds = NIL;
- alterstmt->relkind = OBJECT_TABLE;
+ alterstmt->objtype = OBJECT_TABLE;
foreach(fkclist, cxt->fkconstraints)
{