*** pgsql/src/backend/parser/parse_utilcmd.c 2008/03/25 22:42:43 2.11 --- pgsql/src/backend/parser/parse_utilcmd.c 2008/04/24 20:46:49 2.12 *************** *** 19,25 **** * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * ! * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.10 2008/03/21 22:10:56 tgl Exp $ * *------------------------------------------------------------------------- */ --- 19,25 ---- * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * ! * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.11 2008/03/25 22:42:43 tgl Exp $ * *------------------------------------------------------------------------- */ *************** transformAlterTableStmt(AlterTableStmt * *** 1718,1758 **** { ColumnDef *def = (ColumnDef *) cmd->def; ! Assert(IsA(cmd->def, ColumnDef)); ! transformColumnDefinition(pstate, &cxt, ! (ColumnDef *) cmd->def); /* * If the column has a non-null default, we can't skip * validation of foreign keys. */ ! if (((ColumnDef *) cmd->def)->raw_default != NULL) skipValidation = false; - newcmds = lappend(newcmds, cmd); - - /* - * Convert an ADD COLUMN ... NOT NULL constraint to a - * separate command - */ - if (def->is_not_null) - { - /* Remove NOT NULL from AddColumn */ - def->is_not_null = false; - - /* Add as a separate AlterTableCmd */ - newcmd = makeNode(AlterTableCmd); - newcmd->subtype = AT_SetNotNull; - newcmd->name = pstrdup(def->colname); - newcmds = lappend(newcmds, newcmd); - } - /* * All constraints are processed in other ways. Remove the * original list */ def->constraints = NIL; break; } case AT_AddConstraint: --- 1718,1740 ---- { ColumnDef *def = (ColumnDef *) cmd->def; ! Assert(IsA(def, ColumnDef)); ! transformColumnDefinition(pstate, &cxt, def); /* * If the column has a non-null default, we can't skip * validation of foreign keys. */ ! if (def->raw_default != NULL) skipValidation = false; /* * All constraints are processed in other ways. Remove the * original list */ def->constraints = NIL; + newcmds = lappend(newcmds, cmd); break; } case AT_AddConstraint: *************** transformAlterTableStmt(AlterTableStmt * *** 1760,1766 **** /* * The original AddConstraint cmd node doesn't go to newcmds */ - if (IsA(cmd->def, Constraint)) transformTableConstraint(pstate, &cxt, (Constraint *) cmd->def); --- 1742,1747 ----