diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 0da2220968..9769944023 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -3167,7 +3167,7 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, * if attribute not found, something will error about it * later */ - if (attnum != InvalidAttrNumber && get_attidentity(relid, attnum)) + if (attnum > 0 && get_attidentity(relid, attnum)) { Oid seq_relid = getOwnedSequence(relid, attnum); Oid typeOid = typenameTypeId(pstate, def->typeName);