mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
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 commit09d4e96
, where only OBJECT_TABLE and OBJECT_INDEX were used. This got extended later to use as well OBJECT_TYPE withe440e12
, 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
This commit is contained in:
@ -4709,7 +4709,7 @@ ATParseTransformCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
|
||||
-1);
|
||||
atstmt->relation->inh = recurse;
|
||||
atstmt->cmds = list_make1(cmd);
|
||||
atstmt->relkind = OBJECT_TABLE; /* needn't be picky here */
|
||||
atstmt->objtype = OBJECT_TABLE; /* needn't be picky here */
|
||||
atstmt->missing_ok = false;
|
||||
|
||||
/* Transform the AlterTableStmt */
|
||||
@ -15594,7 +15594,7 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
|
||||
reltype = ((AlterObjectSchemaStmt *) stmt)->objectType;
|
||||
|
||||
else if (IsA(stmt, AlterTableStmt))
|
||||
reltype = ((AlterTableStmt *) stmt)->relkind;
|
||||
reltype = ((AlterTableStmt *) stmt)->objtype;
|
||||
else
|
||||
{
|
||||
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(stmt));
|
||||
|
Reference in New Issue
Block a user