*** ../src/backend/parser/analyze.c.orig Thu Sep 3 14:21:06 1998 --- ../src/backend/parser/analyze.c Wed Sep 16 04:41:24 1998 *************** *** 530,540 **** --- 530,555 ---- constraint->def = cstring; constraint->keys = NULL; + /* The parser only allows PRIMARY KEY as a constraint for the SERIAL type. + * So, if there is a constraint of any kind, assume it is that. + * If PRIMARY KEY is specified, then don't need to gin up a UNIQUE constraint + * since that will be covered already. + * - thomas 1998-09-15 + */ if (column->constraints != NIL) + { column->constraints = lappend(column->constraints, constraint); + } else + { column->constraints = lcons(constraint, NIL); + constraint = makeNode(Constraint); + constraint->contype = CONSTR_UNIQUE; + constraint->name = makeTableName(stmt->relname, column->colname, "key", NULL); + column->constraints = lappend(column->constraints, constraint); + } + sequence = makeNode(CreateSeqStmt); sequence->seqname = pstrdup(constraint->name); sequence->options = NIL; *************** *** 543,554 **** sequence->seqname, stmt->relname, column->colname); ilist = lcons(sequence, NIL); - - constraint = makeNode(Constraint); - constraint->contype = CONSTR_UNIQUE; - constraint->name = makeTableName(stmt->relname, column->colname, "key", NULL); - - column->constraints = lappend(column->constraints, constraint); } if (column->constraints != NIL) --- 558,563 ----