diff options
Diffstat (limited to 'src/backend/parser/parse_utilcmd.c')
-rw-r--r-- | src/backend/parser/parse_utilcmd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index d8387d43569..a6a2de94ea4 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -2919,6 +2919,7 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, const char *queryString) { Relation rel; + TupleDesc tupdesc; ParseState *pstate; CreateStmtContext cxt; List *result; @@ -2938,6 +2939,7 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, /* Caller is responsible for locking the relation */ rel = relation_open(relid, NoLock); + tupdesc = RelationGetDescr(rel); /* Set up pstate */ pstate = make_parsestate(NULL); @@ -3067,7 +3069,8 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, * if attribute not found, something will error about it * later */ - if (attnum != InvalidAttrNumber && get_attidentity(relid, attnum)) + if (attnum != InvalidAttrNumber && + TupleDescAttr(tupdesc, attnum - 1)->attidentity) { Oid seq_relid = getOwnedSequence(relid, attnum); Oid typeOid = typenameTypeId(pstate, def->typeName); |