@ -20,7 +20,7 @@
* Portions Copyright ( c ) 1996 - 2007 , PostgreSQL Global Development Group
* Portions Copyright ( c ) 1994 , Regents of the University of California
*
* $ PostgreSQL : pgsql / src / backend / parser / analyze . c , v 1.365 2007 / 06 / 19 21 : 24 : 48 neilc Exp $
* $ PostgreSQL : pgsql / src / backend / parser / analyze . c , v 1.366 2007 / 06 / 20 18 : 21 : 00 tgl Exp $
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
@ -956,6 +956,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
{
bool is_serial ;
bool saw_nullable ;
bool saw_default ;
Constraint * constraint ;
ListCell * clist ;
@ -1086,6 +1087,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
transformConstraintAttrs ( column - > constraints ) ;
saw_nullable = false ;
saw_default = false ;
foreach ( clist , column - > constraints )
{
@ -1130,13 +1132,15 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
break ;
case CONSTR_DEFAULT :
if ( column - > r aw_default ! = NULL )
if ( s aw_default)
ereport ( ERROR ,
( errcode ( ERRCODE_SYNTAX_ERROR ) ,
errmsg ( " multiple default values specified for column \" %s \" of table \" %s \" " ,
column - > colname , cxt - > relation - > relname ) ) ) ;
/* Note: DEFAULT NULL maps to constraint->raw_expr == NULL */
column - > raw_default = constraint - > raw_expr ;
Assert ( constraint - > cooked_expr = = NULL ) ;
saw_default = true ;
break ;
case CONSTR_PRIMARY :