1919 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
2020 * Portions Copyright (c) 1994, Regents of the University of California
2121 *
22- *$PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.9 2008/02/07 17:09:51 tgl Exp $
22+ *$PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.10 2008/03/21 22:10:56 tgl Exp $
2323 *
2424 *-------------------------------------------------------------------------
2525 */
@@ -266,7 +266,8 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
266266
267267/* Check for SERIAL pseudo-types */
268268is_serial = false;
269- if (list_length (column -> typename -> names )== 1 )
269+ if (list_length (column -> typename -> names )== 1 &&
270+ !column -> typename -> pct_type )
270271{
271272char * typname = strVal (linitial (column -> typename -> names ));
272273
@@ -284,6 +285,16 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
284285column -> typename -> names = NIL ;
285286column -> typename -> typeid = INT8OID ;
286287}
288+
289+ /*
290+ * We have to reject "serial[]" explicitly, because once we've
291+ * set typeid, LookupTypeName won't notice arrayBounds. We don't
292+ * need any special coding for serial(typmod) though.
293+ */
294+ if (is_serial && column -> typename -> arrayBounds != NIL )
295+ ereport (ERROR ,
296+ (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
297+ errmsg ("array of serial is not implemented" )));
287298}
288299
289300/* Do necessary work on the column type declaration */