? src/test/regress/expected/.domain.out.swp ? src/test/regress/sql/.type_sanity.sql.swp Index: src/backend/commands/indexcmds.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/indexcmds.c,v retrieving revision 1.80 diff -c -r1.80 indexcmds.c *** src/backend/commands/indexcmds.c 2002/08/02 18:15:06 1.80 --- src/backend/commands/indexcmds.c 2002/08/12 00:00:43 *************** *** 482,487 **** --- 482,490 ---- Oid exactOid = InvalidOid; Oid compatibleOid = InvalidOid; + /* It could be a domain */ + attrType = getBaseType(attrType); + /* * We scan through all the opclasses available for the access method, * looking for one that is marked default and matches the target type Index: src/backend/commands/sequence.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/sequence.c,v retrieving revision 1.83 diff -c -r1.83 sequence.c *** src/backend/commands/sequence.c 2002/07/16 22:12:19 1.83 --- src/backend/commands/sequence.c 2002/08/12 00:00:48 *************** *** 183,188 **** --- 183,193 ---- coldef->colname = "is_called"; value[i - 1] = BoolGetDatum(false); break; + case SEQ_COL_SERIAL: + typnam->typeid = BOOLOID; + coldef->colname = "is_serial"; + value[i - 1] = BoolGetDatum(seq->is_serial); + } stmt->tableElts = lappend(stmt->tableElts, coldef); } Index: src/backend/nodes/copyfuncs.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/nodes/copyfuncs.c,v retrieving revision 1.198 diff -c -r1.198 copyfuncs.c *** src/backend/nodes/copyfuncs.c 2002/07/29 22:14:10 1.198 --- src/backend/nodes/copyfuncs.c 2002/08/12 00:00:57 *************** *** 2367,2372 **** --- 2367,2373 ---- Node_Copy(from, newnode, sequence); Node_Copy(from, newnode, options); + newnode->is_serial = from->is_serial; return newnode; } Index: src/backend/nodes/equalfuncs.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/nodes/equalfuncs.c,v retrieving revision 1.145 diff -c -r1.145 equalfuncs.c *** src/backend/nodes/equalfuncs.c 2002/07/29 22:14:10 1.145 --- src/backend/nodes/equalfuncs.c 2002/08/12 00:01:04 *************** *** 1204,1209 **** --- 1204,1211 ---- return false; if (!equal(a->options, b->options)) return false; + if (a->is_serial != b->is_serial) + return false; return true; } Index: src/backend/parser/analyze.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/parser/analyze.c,v retrieving revision 1.240 diff -c -r1.240 analyze.c *** src/backend/parser/analyze.c 2002/08/02 18:15:06 1.240 --- src/backend/parser/analyze.c 2002/08/12 00:01:24 *************** *** 784,824 **** transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt, ColumnDef *column) { - bool is_serial; bool saw_nullable; Constraint *constraint; List *clist; Ident *key; cxt->columns = lappend(cxt->columns, column); - /* Check for SERIAL pseudo-types */ - is_serial = false; - if (length(column->typename->names) == 1) - { - char *typname = strVal(lfirst(column->typename->names)); - - if (strcmp(typname, "serial") == 0 || - strcmp(typname, "serial4") == 0) - { - is_serial = true; - column->typename->names = NIL; - column->typename->typeid = INT4OID; - } - else if (strcmp(typname, "bigserial") == 0 || - strcmp(typname, "serial8") == 0) - { - is_serial = true; - column->typename->names = NIL; - column->typename->typeid = INT8OID; - } - } - /* Do necessary work on the column type declaration */ transformColumnType(pstate, column); /* Special actions for SERIAL pseudo-types */ ! if (is_serial) { char *sname; char *snamespace; --- 784,803 ---- transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt, ColumnDef *column) { bool saw_nullable; Constraint *constraint; List *clist; Ident *key; + Oid typeOid; cxt->columns = lappend(cxt->columns, column); /* Do necessary work on the column type declaration */ transformColumnType(pstate, column); /* Special actions for SERIAL pseudo-types */ ! typeOid = LookupTypeName(column->typename); ! if (typeOid == SERIAL4OID || typeOid == SERIAL8OID) { char *sname; char *snamespace; *************** *** 844,849 **** --- 823,829 ---- seqstmt = makeNode(CreateSeqStmt); seqstmt->sequence = makeRangeVar(snamespace, sname); seqstmt->options = NIL; + seqstmt->is_serial = true; cxt->blist = lappend(cxt->blist, seqstmt); Index: src/backend/parser/gram.y =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/parser/gram.y,v retrieving revision 2.352 diff -c -r2.352 gram.y *** src/backend/parser/gram.y 2002/07/31 17:19:51 2.352 --- src/backend/parser/gram.y 2002/08/12 00:01:57 *************** *** 322,328 **** AGGREGATE, ALL, ALTER, ANALYSE, ANALYZE, AND, ANY, AS, ASC, ASSERTION, ASSIGNMENT, AT, AUTHORIZATION, ! BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH, BOOLEAN, BY, CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR_P, --- 322,328 ---- AGGREGATE, ALL, ALTER, ANALYSE, ANALYZE, AND, ANY, AS, ASC, ASSERTION, ASSIGNMENT, AT, AUTHORIZATION, ! BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BIGSERIAL, BINARY, BIT, BOTH, BOOLEAN, BY, CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR_P, *************** *** 375,381 **** RESET, RESTRICT, RETURNS, REVOKE, RIGHT, ROLLBACK, ROW, RULE, ! SCHEMA, SCROLL, SECOND_P, SECURITY, SELECT, SEQUENCE, SERIALIZABLE, SESSION, SESSION_USER, SET, SETOF, SHARE, SHOW, SIMILAR, SIMPLE, SMALLINT, SOME, STABLE, START, STATEMENT, STATISTICS, STDIN, STDOUT, STORAGE, STRICT, SUBSTRING, --- 375,381 ---- RESET, RESTRICT, RETURNS, REVOKE, RIGHT, ROLLBACK, ROW, RULE, ! SCHEMA, SCROLL, SECOND_P, SECURITY, SELECT, SEQUENCE, SERIAL SERIALIZABLE, SESSION, SESSION_USER, SET, SETOF, SHARE, SHOW, SIMILAR, SIMPLE, SMALLINT, SOME, STABLE, START, STATEMENT, STATISTICS, STDIN, STDOUT, STORAGE, STRICT, SUBSTRING, *************** *** 1858,1863 **** --- 1858,1864 ---- $4->istemp = $2; n->sequence = $4; n->options = $5; + n->is_serial = false; $$ = (Node *)n; } ; *************** *** 4789,4794 **** --- 4790,4803 ---- { $$ = SystemTypeName("int8"); } + | SERIAL + { + $$ = SystemTypeName("serial4"); + } + | BIGSERIAL + { + $$ = SystemTypeName("serial8"); + } | REAL { $$ = SystemTypeName("float4"); *************** *** 6858,6863 **** --- 6867,6873 ---- */ col_name_keyword: BIGINT + | BIGSERIAL | BIT | BOOLEAN | CHAR_P *************** *** 6879,6884 **** --- 6889,6895 ---- | POSITION | REAL | ROW + | SERIAL | SETOF | SMALLINT | SUBSTRING Index: src/backend/parser/keywords.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/parser/keywords.c,v retrieving revision 1.123 diff -c -r1.123 keywords.c *** src/backend/parser/keywords.c 2002/07/29 22:14:11 1.123 --- src/backend/parser/keywords.c 2002/08/12 00:01:57 *************** *** 52,57 **** --- 52,58 ---- {"begin", BEGIN_TRANS}, {"between", BETWEEN}, {"bigint", BIGINT}, + {"bigserial", BIGSERIAL}, {"binary", BINARY}, {"bit", BIT}, {"boolean", BOOLEAN}, *************** *** 253,258 **** --- 254,260 ---- {"security", SECURITY}, {"select", SELECT}, {"sequence", SEQUENCE}, + {"serial", SERIAL}, {"serializable", SERIALIZABLE}, {"session", SESSION}, {"session_user", SESSION_USER}, Index: src/backend/parser/parse_coerce.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/parser/parse_coerce.c,v retrieving revision 2.79 diff -c -r2.79 parse_coerce.c *** src/backend/parser/parse_coerce.c 2002/07/20 05:29:01 2.79 --- src/backend/parser/parse_coerce.c 2002/08/12 00:02:00 *************** *** 626,631 **** --- 626,634 ---- if (type1 == type2) return true; + /* Domains are also considered binary compatible with their base type */ + + tuple = SearchSysCache(CASTSOURCETARGET, type1, type2, 0, 0); if (HeapTupleIsValid(tuple)) { Index: src/bin/pg_dump/common.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_dump/common.c,v retrieving revision 1.67 diff -c -r1.67 common.c *** src/bin/pg_dump/common.c 2002/07/30 21:56:04 1.67 --- src/bin/pg_dump/common.c 2002/08/12 00:02:15 *************** *** 262,267 **** --- 262,268 ---- int *parentIndexes; bool foundAttr; /* Attr was found in a parent */ bool foundNotNull; /* Attr was NOT NULL in a parent */ + bool foundPriSerial; /* Attr was a PRIMARY KEY SERIAL in a parent */ bool defaultsMatch; /* All non-empty defaults match */ bool defaultsFound; /* Found a default in a parent */ char *attrDef; *************** *** 299,304 **** --- 300,306 ---- { foundAttr = false; foundNotNull = false; + foundPriSerial = false; defaultsMatch = true; defaultsFound = false; *************** *** 315,320 **** --- 317,323 ---- { foundAttr = true; foundNotNull |= tblinfo[parentInd].notnull[inhAttrInd]; + foundPriSerial |= tblinfo[parentInd].priserial[inhAttrInd]; if (attrDef != NULL) /* If we have a default, * check parent */ { *************** *** 339,344 **** --- 342,348 ---- tblinfo[i].inhAttrs[j] = true; tblinfo[i].inhAttrDef[j] = true; tblinfo[i].inhNotNull[j] = true; + tblinfo[i].inhPriSerial[j] = true; /* * Clear it if attr had a default, but parents did not, or *************** *** 358,363 **** --- 362,376 ---- { tblinfo[i].inhAttrs[j] = false; tblinfo[i].inhNotNull[j] = false; + } + + /* + * Clean it if attr has a primary key'd serial but parents did not + */ + if (tblinfo[i].priserial[j] && !foundPriSerial) + { + tblinfo[i].inhAttrs[j] = false; + tblinfo[i].inhPriSerial[j] = false; } } } Index: src/bin/pg_dump/pg_dump.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_dump/pg_dump.c,v retrieving revision 1.279 diff -c -r1.279 pg_dump.c *** src/bin/pg_dump/pg_dump.c 2002/08/02 18:15:08 1.279 --- src/bin/pg_dump/pg_dump.c 2002/08/12 00:02:43 *************** *** 2353,2361 **** --- 2353,2364 ---- int i_attnotnull; int i_atthasdef; int i_attisdropped; + int i_is_serial; + int i_is_priserial; PGresult *res; int ntups; bool hasdefaults; + bool is_serial; for (i = 0; i < numTables; i++) { *************** *** 2392,2400 **** --- 2395,2413 ---- if (g_fout->remoteVersion >= 70300) { appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, attstattarget, " + "case when n.nspname = 'pg_catalog' " + " and typname in ('serial4', 'serial8') then true " + "else false end as is_serial, " + "case when n.nspname = 'pg_catalog' " + " and typname in ('serial4', 'serial8') then " + " (SELECT true FROM pg_catalog.pg_constraint " + " WHERE contype = 'p' AND conrelid = a.attrelid) " + "else false end as is_priserial, " "attnotnull, atthasdef, attisdropped, " "pg_catalog.format_type(atttypid,atttypmod) as atttypname " "from pg_catalog.pg_attribute a " + "join pg_catalog.pg_type t on (t.oid = a.atttypid) " + "join pg_catalog.pg_namespace n on (t.typnamespace = n.oid) " "where attrelid = '%s'::pg_catalog.oid " "and attnum > 0::pg_catalog.int2 " "order by attrelid, attnum", *************** *** 2408,2413 **** --- 2421,2427 ---- * explicitly set or was just a default. */ appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, -1 as attstattarget, " + "false as is_serial, false as is_priserial, " "attnotnull, atthasdef, false as attisdropped, " "format_type(atttypid,atttypmod) as atttypname " "from pg_attribute a " *************** *** 2420,2425 **** --- 2434,2440 ---- { /* format_type not available before 7.1 */ appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, -1 as attstattarget, " + "false as is_serial, false as is_priserial, " "attnotnull, atthasdef, false as attisdropped, " "(select typname from pg_type where oid = atttypid) as atttypname " "from pg_attribute a " *************** *** 2446,2451 **** --- 2461,2468 ---- i_attnotnull = PQfnumber(res, "attnotnull"); i_atthasdef = PQfnumber(res, "atthasdef"); i_attisdropped = PQfnumber(res, "attisdropped"); + i_is_serial = PQfnumber(res, "is_serial"); + i_is_priserial = PQfnumber(res, "is_priserial"); tblinfo[i].numatts = ntups; tblinfo[i].attnames = (char **) malloc(ntups * sizeof(char *)); *************** *** 2454,2463 **** --- 2471,2482 ---- tblinfo[i].attstattarget = (int *) malloc(ntups * sizeof(int)); tblinfo[i].attisdropped = (bool *) malloc(ntups * sizeof(bool)); tblinfo[i].notnull = (bool *) malloc(ntups * sizeof(bool)); + tblinfo[i].priserial = (bool *) malloc(ntups * sizeof(bool)); tblinfo[i].adef_expr = (char **) malloc(ntups * sizeof(char *)); tblinfo[i].inhAttrs = (bool *) malloc(ntups * sizeof(bool)); tblinfo[i].inhAttrDef = (bool *) malloc(ntups * sizeof(bool)); tblinfo[i].inhNotNull = (bool *) malloc(ntups * sizeof(bool)); + tblinfo[i].inhPriSerial = (bool *) malloc(ntups * sizeof(bool)); hasdefaults = false; for (j = 0; j < ntups; j++) *************** *** 2467,2473 **** tblinfo[i].atttypmod[j] = atoi(PQgetvalue(res, j, i_atttypmod)); tblinfo[i].attstattarget[j] = atoi(PQgetvalue(res, j, i_attstattarget)); tblinfo[i].attisdropped[j] = (PQgetvalue(res, j, i_attisdropped)[0] == 't'); ! tblinfo[i].notnull[j] = (PQgetvalue(res, j, i_attnotnull)[0] == 't'); tblinfo[i].adef_expr[j] = NULL; /* fix below */ if (PQgetvalue(res, j, i_atthasdef)[0] == 't') hasdefaults = true; --- 2486,2499 ---- tblinfo[i].atttypmod[j] = atoi(PQgetvalue(res, j, i_atttypmod)); tblinfo[i].attstattarget[j] = atoi(PQgetvalue(res, j, i_attstattarget)); tblinfo[i].attisdropped[j] = (PQgetvalue(res, j, i_attisdropped)[0] == 't'); ! ! is_serial = (PQgetvalue(res, j, i_is_serial)[0] == 't'); ! if (!is_serial) /* NOT NULL is implicit if it is a serial */ ! tblinfo[i].notnull[j] = (PQgetvalue(res, j, i_attnotnull)[0] == 't'); ! else ! tblinfo[i].notnull[j] = false; ! ! tblinfo[i].priserial[j] = (PQgetvalue(res, j, i_is_priserial)[0] == 't'); tblinfo[i].adef_expr[j] = NULL; /* fix below */ if (PQgetvalue(res, j, i_atthasdef)[0] == 't') hasdefaults = true; *************** *** 2475,2480 **** --- 2501,2507 ---- tblinfo[i].inhAttrs[j] = false; tblinfo[i].inhAttrDef[j] = false; tblinfo[i].inhNotNull[j] = false; + tblinfo[i].inhPriSerial[j] = false; } PQclear(res); *************** *** 2531,2537 **** adnum, tblinfo[i].relname); exit_nicely(); } ! tblinfo[i].adef_expr[adnum-1] = strdup(PQgetvalue(res, j, 1)); } PQclear(res); } --- 2558,2567 ---- adnum, tblinfo[i].relname); exit_nicely(); } ! ! /* Skip the default of the serial column */ ! if (!is_serial) ! tblinfo[i].adef_expr[adnum-1] = strdup(PQgetvalue(res, j, 1)); } PQclear(res); } *************** *** 5036,5041 **** --- 5066,5075 ---- if (tbinfo->notnull[j] && !tbinfo->inhNotNull[j]) appendPQExpBuffer(q, " NOT NULL"); + /* Useful only to serial columns */ + if (tbinfo->priserial[j] && !tbinfo->inhPriSerial[j]) + appendPQExpBuffer(q, " PRIMARY KEY"); + actual_atts++; } } *************** *** 5277,5282 **** --- 5311,5320 ---- resetPQExpBuffer(query); if (g_fout->remoteVersion >= 70300) + /* + * We dumped the uniqness of the serial during table creation + * so skip that here. + */ appendPQExpBuffer(query, "SELECT i.indexrelid as indexreloid, " "coalesce(c.conname, t.relname) as indexrelname, " *************** *** 5288,5294 **** --- 5326,5338 ---- "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) " "LEFT OUTER JOIN pg_catalog.pg_constraint c " " ON (c.conrelid = i.indrelid AND c.conname = t.relname) " + "LEFT OUTER JOIN pg_catalog.pg_type ty " + " ON (c.conkey[1] = ty.oid) " + "LEFT OUTER JOIN pg_catalog.pg_namespace n " + " ON (n.oid = ty.typnamespace) " "WHERE i.indrelid = '%s'::pg_catalog.oid " + "AND NOT (n.nspname = 'pg_catalog' " + " AND ty.typname IN ('serial4', 'serial8')) " "ORDER BY indexrelname", tbinfo->oid); else *************** *** 5567,5583 **** *minv, *cache; bool cycled, ! called; PQExpBuffer query = createPQExpBuffer(); PQExpBuffer delqry = createPQExpBuffer(); /* Make sure we are in proper schema */ selectSourceSchema(tbinfo->relnamespace->nspname); ! appendPQExpBuffer(query, ! "SELECT sequence_name, last_value, increment_by, max_value, " ! "min_value, cache_value, is_cycled, is_called from %s", ! fmtId(tbinfo->relname, force_quotes)); res = PQexec(g_conn, query->data); if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) --- 5611,5640 ---- *minv, *cache; bool cycled, ! called, ! serial; PQExpBuffer query = createPQExpBuffer(); PQExpBuffer delqry = createPQExpBuffer(); /* Make sure we are in proper schema */ selectSourceSchema(tbinfo->relnamespace->nspname); + + + if (g_fout->remoteVersion >= 70300) + { + appendPQExpBuffer(query, + "SELECT sequence_name, last_value, increment_by, max_value, " + "min_value, cache_value, is_cycled, is_called, is_serial " + "from %s", + fmtId(tbinfo->relname, force_quotes)); ! } else { ! appendPQExpBuffer(query, ! "SELECT sequence_name, last_value, increment_by, max_value, " ! "min_value, cache_value, is_cycled, is_called, false as is_serial " ! "from %s", ! fmtId(tbinfo->relname, force_quotes)); ! } res = PQexec(g_conn, query->data); if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) *************** *** 5610,5615 **** --- 5667,5673 ---- cache = PQgetvalue(res, 0, 5); cycled = (strcmp(PQgetvalue(res, 0, 6), "t") == 0); called = (strcmp(PQgetvalue(res, 0, 7), "t") == 0); + serial = (strcmp(PQgetvalue(res, 0, 8), "t") == 0); /* * The logic we use for restoring sequences is as follows: - Add a *************** *** 5620,5626 **** * data */ ! if (!dataOnly) { resetPQExpBuffer(delqry); --- 5678,5684 ---- * data */ ! if (!dataOnly && !serial) { resetPQExpBuffer(delqry); Index: src/bin/pg_dump/pg_dump.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_dump/pg_dump.h,v retrieving revision 1.94 diff -c -r1.94 pg_dump.h *** src/bin/pg_dump/pg_dump.h 2002/08/02 18:15:08 1.94 --- src/bin/pg_dump/pg_dump.h 2002/08/12 00:02:43 *************** *** 130,139 **** --- 130,141 ---- */ bool *attisdropped; /* true if attr is dropped; don't dump it */ bool *notnull; /* Not null constraints on attributes */ + bool *priserial; /* true is a primary key'd serial attribute */ char **adef_expr; /* DEFAULT expressions */ bool *inhAttrs; /* true if each attribute is inherited */ bool *inhAttrDef; /* true if attr's default is inherited */ bool *inhNotNull; /* true if NOT NULL is inherited */ + bool *inhPriSerial; /* true is primary key'd serial is inherited */ /* * Stuff computed only for dumpable tables. Index: src/include/catalog/pg_type.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/include/catalog/pg_type.h,v retrieving revision 1.125 diff -c -r1.125 pg_type.h *** src/include/catalog/pg_type.h 2002/07/24 19:11:13 1.125 --- src/include/catalog/pg_type.h 2002/08/12 00:02:53 *************** *** 451,456 **** --- 451,462 ---- #define TIMETZOID 1266 DATA(insert OID = 1270 ( _timetz PGNSP PGUID -1 f b t \054 0 1266 array_in array_out d x f 0 -1 0 _null_ _null_ )); + /* OIDS 1300 - 1399 */ + DATA(insert OID = 1362 ( serial4 PGNSP PGUID 4 t d t \054 0 0 int4in int4out i p f 23 -1 0 _null_ _null_ )); + #define SERIAL4OID 1362 + DATA(insert OID = 1365 ( serial8 PGNSP PGUID 8 f d t \054 0 0 int8in int8out d p f 20 -1 0 _null_ _null_ )); + #define SERIAL8OID 1365 + /* OIDS 1500 - 1599 */ DATA(insert OID = 1560 ( bit PGNSP PGUID -1 f b t \054 0 0 bit_in bit_out i x f 0 -1 0 _null_ _null_ )); DESCR("fixed-length bit string"); Index: src/include/commands/sequence.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/include/commands/sequence.h,v retrieving revision 1.21 diff -c -r1.21 sequence.h *** src/include/commands/sequence.h 2002/06/20 20:29:49 1.21 --- src/include/commands/sequence.h 2002/08/12 00:02:53 *************** *** 48,53 **** --- 48,54 ---- #endif bool is_cycled; bool is_called; + bool is_serial; } FormData_pg_sequence; typedef FormData_pg_sequence *Form_pg_sequence; *************** *** 65,73 **** #define SEQ_COL_LOG 7 #define SEQ_COL_CYCLE 8 #define SEQ_COL_CALLED 9 #define SEQ_COL_FIRSTCOL SEQ_COL_NAME ! #define SEQ_COL_LASTCOL SEQ_COL_CALLED /* XLOG stuff */ #define XLOG_SEQ_LOG 0x00 --- 66,75 ---- #define SEQ_COL_LOG 7 #define SEQ_COL_CYCLE 8 #define SEQ_COL_CALLED 9 + #define SEQ_COL_SERIAL 10 #define SEQ_COL_FIRSTCOL SEQ_COL_NAME ! #define SEQ_COL_LASTCOL SEQ_COL_SERIAL /* XLOG stuff */ #define XLOG_SEQ_LOG 0x00 Index: src/include/nodes/parsenodes.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/include/nodes/parsenodes.h,v retrieving revision 1.196 diff -c -r1.196 parsenodes.h *** src/include/nodes/parsenodes.h 2002/07/30 16:55:45 1.196 --- src/include/nodes/parsenodes.h 2002/08/12 00:03:18 *************** *** 1089,1094 **** --- 1089,1095 ---- NodeTag type; RangeVar *sequence; /* the sequence to create */ List *options; + bool is_serial; } CreateSeqStmt; /* ---------------------- Index: src/test/regress/expected/alter_table.out =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/test/regress/expected/alter_table.out,v retrieving revision 1.46 diff -c -r1.46 alter_table.out *** src/test/regress/expected/alter_table.out 2002/08/02 18:15:09 1.46 --- src/test/regress/expected/alter_table.out 2002/08/12 00:03:35 *************** *** 290,298 **** CREATE SEQUENCE foo_seq; ALTER TABLE foo_seq RENAME TO foo_seq_new; SELECT * FROM foo_seq_new; ! sequence_name | last_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called ! ---------------+------------+--------------+---------------------+-----------+-------------+---------+-----------+----------- ! foo_seq | 1 | 1 | 9223372036854775807 | 1 | 1 | 1 | f | f (1 row) DROP SEQUENCE foo_seq_new; --- 290,298 ---- CREATE SEQUENCE foo_seq; ALTER TABLE foo_seq RENAME TO foo_seq_new; SELECT * FROM foo_seq_new; ! sequence_name | last_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called | is_serial ! ---------------+------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------+----------- ! foo_seq | 1 | 1 | 9223372036854775807 | 1 | 1 | 1 | f | f | f (1 row) DROP SEQUENCE foo_seq_new; Index: src/test/regress/expected/domain.out =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/test/regress/expected/domain.out,v retrieving revision 1.7 diff -c -r1.7 domain.out *** src/test/regress/expected/domain.out 2002/07/12 18:43:19 1.7 --- src/test/regress/expected/domain.out 2002/08/12 00:03:37 *************** *** 148,163 **** , col6 ddef2 DEFAULT '88' , col7 ddef4 DEFAULT 8000 , col8 ddef5 ); insert into defaulttest default values; insert into defaulttest default values; insert into defaulttest default values; select * from defaulttest; ! col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 ! ------+------+------+------+------+------+------+------- ! 3 | 12 | 5 | 1 | 3 | 88 | 8000 | 12.12 ! 3 | 12 | 5 | 2 | 3 | 88 | 8000 | 12.12 ! 3 | 12 | 5 | 3 | 3 | 88 | 8000 | 12.12 (3 rows) drop sequence ddef4_seq; --- 148,166 ---- , col6 ddef2 DEFAULT '88' , col7 ddef4 DEFAULT 8000 , col8 ddef5 + , col9 serial primary key -- Ensure domains work with indexes ); + NOTICE: CREATE TABLE will create implicit sequence 'defaulttest_col9_seq' for SERIAL column 'defaulttest.col9' + NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'defaulttest_pkey' for table 'defaulttest' insert into defaulttest default values; insert into defaulttest default values; insert into defaulttest default values; select * from defaulttest; ! col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | col9 ! ------+------+------+------+------+------+------+-------+------ ! 3 | 12 | 5 | 1 | 3 | 88 | 8000 | 12.12 | 1 ! 3 | 12 | 5 | 2 | 3 | 88 | 8000 | 12.12 | 2 ! 3 | 12 | 5 | 3 | 3 | 88 | 8000 | 12.12 | 3 (3 rows) drop sequence ddef4_seq; Index: src/test/regress/expected/random.out =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/test/regress/expected/random.out,v retrieving revision 1.3 diff -c -r1.3 random.out *** src/test/regress/expected/random.out 2000/01/06 06:40:54 1.3 --- src/test/regress/expected/random.out 2002/08/12 00:03:41 *************** *** 31,35 **** WHERE random NOT BETWEEN 80 AND 120; random -------- ! (0 rows) --- 31,36 ---- WHERE random NOT BETWEEN 80 AND 120; random -------- ! 121 ! (1 row) Index: src/test/regress/expected/type_sanity.out =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/test/regress/expected/type_sanity.out,v retrieving revision 1.9 diff -c -r1.9 type_sanity.out *** src/test/regress/expected/type_sanity.out 2002/07/24 19:11:14 1.9 --- src/test/regress/expected/type_sanity.out 2002/08/12 00:03:44 *************** *** 16,22 **** SELECT p1.oid, p1.typname FROM pg_type as p1 WHERE (p1.typlen <= 0 AND p1.typlen != -1) OR ! (p1.typtype != 'b' AND p1.typtype != 'c') OR NOT p1.typisdefined OR (p1.typalign != 'c' AND p1.typalign != 's' AND p1.typalign != 'i' AND p1.typalign != 'd') OR --- 16,22 ---- SELECT p1.oid, p1.typname FROM pg_type as p1 WHERE (p1.typlen <= 0 AND p1.typlen != -1) OR ! p1.typtype not in('b', 'c', 'd') OR NOT p1.typisdefined OR (p1.typalign != 'c' AND p1.typalign != 's' AND p1.typalign != 'i' AND p1.typalign != 'd') OR *************** *** 60,66 **** -- NOTE: as of 7.3, this check finds SET, smgr, and unknown. SELECT p1.oid, p1.typname FROM pg_type as p1 ! WHERE p1.typtype != 'c' AND p1.typname NOT LIKE '\\_%' AND NOT EXISTS (SELECT 1 FROM pg_type as p2 WHERE p2.typname = ('_' || p1.typname)::name AND p2.typelem = p1.oid); --- 60,66 ---- -- NOTE: as of 7.3, this check finds SET, smgr, and unknown. SELECT p1.oid, p1.typname FROM pg_type as p1 ! WHERE p1.typtype not in('c','d') AND p1.typname NOT LIKE '\\_%' AND NOT EXISTS (SELECT 1 FROM pg_type as p2 WHERE p2.typname = ('_' || p1.typname)::name AND p2.typelem = p1.oid); Index: src/test/regress/sql/domain.sql =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/test/regress/sql/domain.sql,v retrieving revision 1.4 diff -c -r1.4 domain.sql *** src/test/regress/sql/domain.sql 2002/07/12 18:43:19 1.4 --- src/test/regress/sql/domain.sql 2002/08/12 00:03:45 *************** *** 115,121 **** , col5 ddef1 NOT NULL DEFAULT NULL , col6 ddef2 DEFAULT '88' , col7 ddef4 DEFAULT 8000 ! , col8 ddef5 ); insert into defaulttest default values; insert into defaulttest default values; --- 115,122 ---- , col5 ddef1 NOT NULL DEFAULT NULL , col6 ddef2 DEFAULT '88' , col7 ddef4 DEFAULT 8000 ! , col8 ddef5 ! , col9 serial primary key -- Ensure domains work with indexes ); insert into defaulttest default values; insert into defaulttest default values; Index: src/test/regress/sql/type_sanity.sql =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/test/regress/sql/type_sanity.sql,v retrieving revision 1.9 diff -c -r1.9 type_sanity.sql *** src/test/regress/sql/type_sanity.sql 2002/07/24 19:11:14 1.9 --- src/test/regress/sql/type_sanity.sql 2002/08/12 00:03:48 *************** *** 19,25 **** SELECT p1.oid, p1.typname FROM pg_type as p1 WHERE (p1.typlen <= 0 AND p1.typlen != -1) OR ! (p1.typtype != 'b' AND p1.typtype != 'c') OR NOT p1.typisdefined OR (p1.typalign != 'c' AND p1.typalign != 's' AND p1.typalign != 'i' AND p1.typalign != 'd') OR --- 19,25 ---- SELECT p1.oid, p1.typname FROM pg_type as p1 WHERE (p1.typlen <= 0 AND p1.typlen != -1) OR ! p1.typtype not in('b', 'c', 'd') OR NOT p1.typisdefined OR (p1.typalign != 'c' AND p1.typalign != 's' AND p1.typalign != 'i' AND p1.typalign != 'd') OR *************** *** 55,61 **** SELECT p1.oid, p1.typname FROM pg_type as p1 ! WHERE p1.typtype != 'c' AND p1.typname NOT LIKE '\\_%' AND NOT EXISTS (SELECT 1 FROM pg_type as p2 WHERE p2.typname = ('_' || p1.typname)::name AND p2.typelem = p1.oid); --- 55,61 ---- SELECT p1.oid, p1.typname FROM pg_type as p1 ! WHERE p1.typtype not in('c','d') AND p1.typname NOT LIKE '\\_%' AND NOT EXISTS (SELECT 1 FROM pg_type as p2 WHERE p2.typname = ('_' || p1.typname)::name AND p2.typelem = p1.oid);