diff -urN pgsql.orig/doc/src/sgml/datatype.sgml pgsql/doc/src/sgml/datatype.sgml
--- pgsql.orig/doc/src/sgml/datatype.sgml	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/doc/src/sgml/datatype.sgml	2006-08-01 14:28:30.000000000 +0200
@@ -697,25 +697,29 @@
 <programlisting>
 CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
     <replaceable class="parameter">colname</replaceable> SERIAL
+	[ GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( <replaceable>sequence_options</replaceable> ) ] ]
 );
 </programlisting>
 
      is equivalent to specifying:
 
 <programlisting>
-CREATE SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_seq;
+CREATE SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_seq
+	[ <replaceable>sequence_options</replaceable> ];
 CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
     <replaceable class="parameter">colname</replaceable> integer DEFAULT nextval('<replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_seq') NOT NULL
 );
 </programlisting>
 
      Thus, we have created an integer column and arranged for its default
-     values to be assigned from a sequence generator.  A <literal>NOT NULL</>
-     constraint is applied to ensure that a null value cannot be explicitly
-     inserted, either.  In most cases you would also want to attach a
-     <literal>UNIQUE</> or <literal>PRIMARY KEY</> constraint to prevent
-     duplicate values from being inserted by accident, but this is
-     not automatic.
+     values to be assigned from a sequence generator with the optional
+     <replaceable class="parameter">sequence_options</replaceable>.
+     For the options, look for the documentation of <programlisting>CREATE SEQUENCE</programlisting>.
+     A <literal>NOT NULL</> constraint is applied to ensure that
+     a null value cannot be explicitly inserted, either.
+     In most cases you would also want to attach a <literal>UNIQUE</> or
+     <literal>PRIMARY KEY</> constraint to prevent duplicate values
+     from being inserted by accident, but this is not automatic.
     </para>
 
     <note>
diff -urN pgsql.orig/doc/src/sgml/ref/create_table.sgml pgsql/doc/src/sgml/ref/create_table.sgml
--- pgsql.orig/doc/src/sgml/ref/create_table.sgml	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/doc/src/sgml/ref/create_table.sgml	2006-08-01 14:49:57.000000000 +0200
@@ -21,7 +21,9 @@
  <refsynopsisdiv>
 <synopsis>
 CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable class="PARAMETER">table_name</replaceable> ( [
-  { <replaceable class="PARAMETER">column_name</replaceable> <replaceable class="PARAMETER">data_type</replaceable> [ DEFAULT <replaceable>default_expr</> ] [ <replaceable class="PARAMETER">column_constraint</replaceable> [ ... ] ]
+  { <replaceable class="PARAMETER">column_name</replaceable> <replaceable class="PARAMETER">data_type</replaceable>
+    | [ { DEFAULT <replaceable>default_expr</> | GENERATED ALWAYS AS (<replaceable>default_expr</replaceable> ) | GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( [ <replaceable>sequence_options</replaceable> ] ) ] } ]
+    | [ <replaceable class="PARAMETER">column_constraint</replaceable> [ ... ] ]
     | <replaceable>table_constraint</replaceable>
     | LIKE <replaceable>parent_table</replaceable> [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS } ] ... }
     [, ... ]
@@ -186,6 +188,42 @@
    </varlistentry>
 
    <varlistentry>
+    <term><literal>GENERATED ALWAYS AS (
+    <replaceable>default_expr</replaceable> ) </literal></term>
+    <listitem>
+     <para>
+      This is similar to the <literal>DEFAULT</> clause, except
+      in an insert operation, where the default data value will
+      be used for the column even when an expression is specified.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
+    <term><literal>GENERATED { ALWAYS BY DEFAULT } AS IDENTITY (
+    <replaceable>sequence_options</replaceable> ) </literal></term>
+    <listitem>
+     <para>
+      This clause creates an identity column, whose default value
+      will be generated by an automatically created sequence.
+      For the <literal>SERIAL</> type this is implicit.
+      However, any type that has implicit cast from bigint
+      can be specified for the column.
+     </para>
+
+     <para>
+      With <literal>GENERATED ALWAYS AS IDENTITY</literal>, the default value
+      will always be used in an insert operation.
+      With this feature, one can approximate the
+      autoincrementer type that other DBMSs provide, e.g.
+      <literal>INSERT INTO table (id, ... ) VALUES (0, ...);</literal>
+      will insert a new column with the next sequence value
+      instead of 0.
+     </para>
+    </listitem>
+   </varlistentry>
+
+   <varlistentry>
     <term><literal>INHERITS ( <replaceable>parent_table</replaceable> [, ... ] )</literal></term>
     <listitem>
      <para>
diff -urN pgsql.orig/src/backend/access/common/tupdesc.c pgsql/src/backend/access/common/tupdesc.c
--- pgsql.orig/src/backend/access/common/tupdesc.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/access/common/tupdesc.c	2006-08-01 13:45:11.000000000 +0200
@@ -142,6 +142,7 @@
 		memcpy(desc->attrs[i], tupdesc->attrs[i], ATTRIBUTE_TUPLE_SIZE);
 		desc->attrs[i]->attnotnull = false;
 		desc->attrs[i]->atthasdef = false;
+		desc->attrs[i]->attforceddef = false;
 	}
 
 	desc->tdtypeid = tupdesc->tdtypeid;
@@ -356,6 +357,8 @@
 			return false;
 		if (attr1->attinhcount != attr2->attinhcount)
 			return false;
+		if (attr1->attforceddef != attr2->attforceddef)
+			return false;
 	}
 
 	if (tupdesc1->constr != NULL)
@@ -471,6 +474,7 @@
 	att->attisdropped = false;
 	att->attislocal = true;
 	att->attinhcount = 0;
+	att->attforceddef = false;
 
 	tuple = SearchSysCache(TYPEOID,
 						   ObjectIdGetDatum(oidtypeid),
@@ -563,6 +567,7 @@
 			attrdef[ndef].adbin = pstrdup(entry->cooked_default);
 			ndef++;
 			desc->attrs[attnum - 1]->atthasdef = true;
+			desc->attrs[attnum - 1]->attforceddef = entry->force_default;
 		}
 
 		desc->attrs[attnum - 1]->attislocal = entry->is_local;
diff -urN pgsql.orig/src/backend/catalog/heap.c pgsql/src/backend/catalog/heap.c
--- pgsql.orig/src/backend/catalog/heap.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/catalog/heap.c	2006-08-01 13:46:24.000000000 +0200
@@ -1202,6 +1202,7 @@
 			 myattnum, myrelid);
 
 	((Form_pg_attribute) GETSTRUCT(tuple))->atthasdef = false;
+	((Form_pg_attribute) GETSTRUCT(tuple))->attforceddef = false;
 
 	simple_heap_update(attr_rel, &tuple->t_self, tuple);
 
@@ -1295,7 +1296,7 @@
  * The expression must be presented as a nodeToString() string.
  */
 void
-StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin)
+StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin, bool attforceddef)
 {
 	Node	   *expr;
 	char	   *adsrc;
@@ -1368,6 +1369,7 @@
 	if (!attStruct->atthasdef)
 	{
 		attStruct->atthasdef = true;
+		attStruct->attforceddef = attforceddef;
 		simple_heap_update(attrrel, &atttup->t_self, atttup);
 		/* keep catalog indexes current */
 		CatalogUpdateIndexes(attrrel, atttup);
@@ -1504,7 +1506,8 @@
 
 	for (i = 0; i < constr->num_defval; i++)
 		StoreAttrDefault(rel, constr->defval[i].adnum,
-						 constr->defval[i].adbin);
+						 constr->defval[i].adbin,
+						 false);
 
 	for (i = 0; i < constr->num_check; i++)
 		StoreRelCheck(rel, constr->check[i].ccname,
@@ -1589,13 +1592,14 @@
 						   atp->atttypid, atp->atttypmod,
 						   NameStr(atp->attname));
 
-		StoreAttrDefault(rel, colDef->attnum, nodeToString(expr));
+		StoreAttrDefault(rel, colDef->attnum, nodeToString(expr), colDef->force_default);
 
 		cooked = (CookedConstraint *) palloc(sizeof(CookedConstraint));
 		cooked->contype = CONSTR_DEFAULT;
 		cooked->name = NULL;
 		cooked->attnum = colDef->attnum;
 		cooked->expr = expr;
+		cooked->force_default = colDef->force_default;
 		cookedConstraints = lappend(cookedConstraints, cooked);
 	}
 
diff -urN pgsql.orig/src/backend/catalog/index.c pgsql/src/backend/catalog/index.c
--- pgsql.orig/src/backend/catalog/index.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/catalog/index.c	2006-08-01 07:44:34.000000000 +0200
@@ -146,6 +146,7 @@
 			to->atthasdef = false;
 			to->attislocal = true;
 			to->attinhcount = 0;
+			to->attforceddef = false;
 		}
 		else
 		{
diff -urN pgsql.orig/src/backend/commands/sequence.c pgsql/src/backend/commands/sequence.c
--- pgsql.orig/src/backend/commands/sequence.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/commands/sequence.c	2006-08-01 12:27:51.000000000 +0200
@@ -124,6 +124,7 @@
 		coldef->cooked_default = NULL;
 		coldef->constraints = NIL;
 		coldef->support = NULL;
+		coldef->force_default = false;
 
 		null[i - 1] = ' ';
 
diff -urN pgsql.orig/src/backend/commands/tablecmds.c pgsql/src/backend/commands/tablecmds.c
--- pgsql.orig/src/backend/commands/tablecmds.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/commands/tablecmds.c	2006-08-01 13:48:00.000000000 +0200
@@ -500,6 +500,7 @@
 			rawEnt = (RawColumnDefault *) palloc(sizeof(RawColumnDefault));
 			rawEnt->attnum = attnum;
 			rawEnt->raw_default = colDef->raw_default;
+			rawEnt->force_default = colDef->force_default;
 			rawDefaults = lappend(rawDefaults, rawEnt);
 		}
 
@@ -945,6 +946,7 @@
 				def->cooked_default = NULL;
 				def->constraints = NIL;
 				def->support = NULL;
+				def->force_default = false;
 				inhSchema = lappend(inhSchema, def);
 				newattno[parent_attno - 1] = ++child_attno;
 			}
@@ -989,6 +991,7 @@
 					def->cooked_default = bogus_marker;
 					have_bogus_defaults = true;
 				}
+				def->force_default = attribute->attforceddef;
 			}
 		}
 
@@ -1074,6 +1077,7 @@
 				{
 					def->raw_default = newdef->raw_default;
 					def->cooked_default = newdef->cooked_default;
+					def->force_default = newdef->force_default;
 				}
 			}
 			else
@@ -3156,6 +3160,7 @@
 	attribute->attisdropped = false;
 	attribute->attislocal = colDef->is_local;
 	attribute->attinhcount = colDef->inhcount;
+	attribute->attforceddef = false;
 
 	ReleaseSysCache(typeTuple);
 
@@ -3193,6 +3198,7 @@
 		rawEnt = (RawColumnDefault *) palloc(sizeof(RawColumnDefault));
 		rawEnt->attnum = attribute->attnum;
 		rawEnt->raw_default = copyObject(colDef->raw_default);
+		rawEnt->force_default = colDef->force_default;
 
 		/*
 		 * This function is intended for CREATE TABLE, so it processes a
@@ -3485,6 +3491,7 @@
 		rawEnt = (RawColumnDefault *) palloc(sizeof(RawColumnDefault));
 		rawEnt->attnum = attnum;
 		rawEnt->raw_default = newDefault;
+		rawEnt->force_default = false;
 
 		/*
 		 * This function is intended for CREATE TABLE, so it processes a
@@ -4988,6 +4995,7 @@
 	ScanKeyData key[3];
 	SysScanDesc scan;
 	HeapTuple	depTup;
+	bool		attforceddef;
 
 	attrelation = heap_open(AttributeRelationId, RowExclusiveLock);
 
@@ -5044,6 +5052,7 @@
 	}
 	else
 		defaultexpr = NULL;
+	attforceddef = attTup->attforceddef;
 
 	/*
 	 * Find everything that depends on the column (constraints, indexes, etc),
@@ -5292,7 +5301,7 @@
 		 */
 		RemoveAttrDefault(RelationGetRelid(rel), attnum, DROP_RESTRICT, true);
 
-		StoreAttrDefault(rel, attnum, nodeToString(defaultexpr));
+		StoreAttrDefault(rel, attnum, nodeToString(defaultexpr), attforceddef);
 	}
 
 	/* Cleanup */
diff -urN pgsql.orig/src/backend/commands/view.c pgsql/src/backend/commands/view.c
--- pgsql.orig/src/backend/commands/view.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/commands/view.c	2006-08-01 12:29:39.000000000 +0200
@@ -127,6 +127,7 @@
 			def->cooked_default = NULL;
 			def->constraints = NIL;
 			def->support = NULL;
+			def->force_default = false;
 
 			attrList = lappend(attrList, def);
 		}
diff -urN pgsql.orig/src/backend/nodes/copyfuncs.c pgsql/src/backend/nodes/copyfuncs.c
--- pgsql.orig/src/backend/nodes/copyfuncs.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/nodes/copyfuncs.c	2006-08-01 07:44:34.000000000 +0200
@@ -1625,6 +1625,7 @@
 	COPY_STRING_FIELD(cooked_default);
 	COPY_NODE_FIELD(constraints);
 	COPY_NODE_FIELD(support);
+	COPY_SCALAR_FIELD(force_default);
 
 	return newnode;
 }
@@ -1641,6 +1642,8 @@
 	COPY_NODE_FIELD(keys);
 	COPY_NODE_FIELD(options);
 	COPY_STRING_FIELD(indexspace);
+	COPY_SCALAR_FIELD(force_default);
+	COPY_NODE_FIELD(seq_opts);
 
 	return newnode;
 }
diff -urN pgsql.orig/src/backend/nodes/equalfuncs.c pgsql/src/backend/nodes/equalfuncs.c
--- pgsql.orig/src/backend/nodes/equalfuncs.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/nodes/equalfuncs.c	2006-08-01 07:44:34.000000000 +0200
@@ -1660,6 +1660,7 @@
 	COMPARE_STRING_FIELD(cooked_default);
 	COMPARE_NODE_FIELD(constraints);
 	COMPARE_NODE_FIELD(support);
+	COMPARE_SCALAR_FIELD(force_default);
 
 	return true;
 }
@@ -1674,6 +1675,8 @@
 	COMPARE_NODE_FIELD(keys);
 	COMPARE_NODE_FIELD(options);
 	COMPARE_STRING_FIELD(indexspace);
+	COMPARE_SCALAR_FIELD(force_default);
+	COMPARE_NODE_FIELD(seq_opts);
 
 	return true;
 }
diff -urN pgsql.orig/src/backend/nodes/outfuncs.c pgsql/src/backend/nodes/outfuncs.c
--- pgsql.orig/src/backend/nodes/outfuncs.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/nodes/outfuncs.c	2006-08-01 07:44:34.000000000 +0200
@@ -1436,6 +1436,7 @@
 	WRITE_STRING_FIELD(cooked_default);
 	WRITE_NODE_FIELD(constraints);
 	WRITE_NODE_FIELD(support);
+	WRITE_BOOL_FIELD(force_default);
 }
 
 static void
@@ -1783,6 +1784,13 @@
 			appendStringInfo(str, "DEFAULT");
 			WRITE_NODE_FIELD(raw_expr);
 			WRITE_STRING_FIELD(cooked_expr);
+			WRITE_BOOL_FIELD(force_default);
+			break;
+
+		case CONSTR_IDENTITY:
+			appendStringInfo(str, "IDENTITY");
+			WRITE_NODE_FIELD(seq_opts);
+			WRITE_BOOL_FIELD(force_default);
 			break;
 
 		case CONSTR_NOTNULL:
diff -urN pgsql.orig/src/backend/parser/analyze.c pgsql/src/backend/parser/analyze.c
--- pgsql.orig/src/backend/parser/analyze.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/parser/analyze.c	2006-08-01 13:50:22.000000000 +0200
@@ -825,6 +825,9 @@
 	bool		saw_nullable;
 	Constraint *constraint;
 	ListCell   *clist;
+	bool		saw_identity;
+	bool		force_default;
+	List	   *seq_opts;
 
 	cxt->columns = lappend(cxt->columns, column);
 
@@ -850,6 +853,31 @@
 		}
 	}
 
+	/* Check for GENERATED ... AS IDENTITY constructs */
+	saw_identity = false;
+	force_default = false;
+	seq_opts = NULL;
+	foreach(clist, column->constraints)
+	{
+		constraint = lfirst(clist);
+
+		switch (constraint->contype) {
+			case CONSTR_IDENTITY:
+				if (saw_identity)
+					ereport(ERROR,
+						(errcode(ERRCODE_SYNTAX_ERROR),
+						 errmsg("multiple GENERATED ... AS IDENTITY constructs specified for column \"%s\" of table \"%s\"",
+							  column->colname, cxt->relation->relname)));
+				saw_identity = true;
+				is_serial = true;
+				force_default = constraint->force_default;
+				seq_opts = constraint->seq_opts;
+				break;
+			default:
+				continue;
+		}
+	}
+
 	/* Do necessary work on the column type declaration */
 	transformColumnType(pstate, column);
 
@@ -894,7 +922,7 @@
 		 */
 		seqstmt = makeNode(CreateSeqStmt);
 		seqstmt->sequence = makeRangeVar(snamespace, sname);
-		seqstmt->options = NIL;
+		seqstmt->options = seq_opts;
 
 		cxt->blist = lappend(cxt->blist, seqstmt);
 
@@ -931,6 +959,7 @@
 		constraint->raw_expr = (Node *) funccallnode;
 		constraint->cooked_expr = NULL;
 		constraint->keys = NIL;
+		constraint->force_default = force_default;
 		column->constraints = lappend(column->constraints, constraint);
 
 		constraint = makeNode(Constraint);
@@ -992,9 +1021,13 @@
 							 errmsg("multiple default values specified for column \"%s\" of table \"%s\"",
 								  column->colname, cxt->relation->relname)));
 				column->raw_default = constraint->raw_expr;
+				force_default = constraint->force_default;
 				Assert(constraint->cooked_expr == NULL);
 				break;
 
+			case CONSTR_IDENTITY:	/* This was processed above, we only have to detect it here. */
+				break;
+
 			case CONSTR_PRIMARY:
 			case CONSTR_UNIQUE:
 				if (constraint->keys == NIL)
@@ -1019,6 +1052,7 @@
 				break;
 		}
 	}
+	column->force_default = force_default;
 }
 
 static void
@@ -1161,6 +1195,7 @@
 		def->cooked_default = NULL;
 		def->constraints = NIL;
 		def->support = NULL;
+		def->force_default = false;
 
 		/*
 		 * Add to column list
@@ -1195,6 +1230,7 @@
 			 */
 
 			def->cooked_default = pstrdup(this_default);
+			def->force_default = attribute->attforceddef;
 		}
 	}
 	
diff -urN pgsql.orig/src/backend/parser/gram.y pgsql/src/backend/parser/gram.y
--- pgsql.orig/src/backend/parser/gram.y	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/parser/gram.y	2006-08-01 12:31:08.000000000 +0200
@@ -337,6 +337,7 @@
 %type <ival>	TableLikeOption
 %type <list>	ColQualList
 %type <node>	ColConstraint ColConstraintElem ConstraintAttr
+%type <node>	AlwaysByDefault IdentityGenerated IdentitySpec
 %type <ival>	key_actions key_delete key_match key_update key_action
 %type <ival>	ConstraintAttributeSpec ConstraintDeferrabilitySpec
 				ConstraintTimeSpec
@@ -356,7 +357,7 @@
 
 /* ordinary key words in alphabetical order */
 %token <keyword> ABORT_P ABSOLUTE_P ACCESS ACTION ADD_P ADMIN AFTER
-	AGGREGATE ALL ALSO ALTER ANALYSE ANALYZE AND ANY ARRAY AS ASC
+	AGGREGATE ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY ARRAY AS ASC
 	ASSERTION ASSIGNMENT ASYMMETRIC AT AUTHORIZATION
 
 	BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
@@ -379,11 +380,11 @@
 	FALSE_P FETCH FIRST_P FLOAT_P FOR FORCE FOREIGN FORWARD
 	FREEZE FROM FULL FUNCTION
 
-	GLOBAL GRANT GRANTED GREATEST GROUP_P
+	GENERATED GLOBAL GRANT GRANTED GREATEST GROUP_P
 
 	HANDLER HAVING HEADER_P HOLD HOUR_P
 
-	IF_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P INCLUDING INCREMENT
+	IDENTITY IF_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P INCLUDING INCREMENT
 	INDEX INDEXES INHERIT INHERITS INITIALLY INNER_P INOUT INPUT_P
 	INSENSITIVE INSERT INSTEAD INT_P INTEGER INTERSECT
 	INTERVAL INTO INVOKER IS ISNULL ISOLATION
@@ -1829,6 +1830,7 @@
 					n->typename = $2;
 					n->constraints = $3;
 					n->is_local = true;
+					n->force_default = false;
 					$$ = (Node *)n;
 				}
 		;
@@ -1878,6 +1880,11 @@
  * DEFAULT expression must be b_expr not a_expr to prevent shift/reduce
  * conflict on NOT (since NOT might start a subsequent NOT NULL constraint,
  * or be part of a_expr NOT LIKE or similar constructs).
+ *
+ * In the SQL2003 spec, DEFAULT, GENERATED ... AS IDENTITY and
+ * GENERATED ALWAYS AS () are mutually exclusive, that will
+ * be handled by analyze.c as conflicting DEFAULT constraints.
+ * - Zoltan Boszormenyi <zboszor@dunaweb.hu>
  */
 ColConstraintElem:
 			NOT NULL_P
@@ -1970,6 +1977,67 @@
 					n->initdeferred		= FALSE;
 					$$ = (Node *)n;
 				}
+			| GENERATED AlwaysByDefault
+				{
+					$$ = $2;
+				}
+		;
+
+AlwaysByDefault:
+		BY DEFAULT AS IDENTITY IdentitySpec
+				{
+					$$ = $5;
+				}
+		| ALWAYS AS IdentityGenerated
+				{
+					Constraint *n = (Constraint *)$3;
+					n->force_default = true;
+					$$ = (Node *)n;
+				}
+		;
+
+IdentityGenerated:
+		'(' b_expr ')'
+				{
+					Constraint *n = makeNode(Constraint);
+					n->contype = CONSTR_DEFAULT;
+					n->name = NULL;
+					n->raw_expr = $2;
+					n->cooked_expr = NULL;
+					n->keys = NULL;
+					n->indexspace = NULL;
+					$$ = (Node *)n;
+				}
+		| IDENTITY IdentitySpec
+				{
+					$$ = $2;
+				}
+		;
+
+IdentitySpec:	'(' OptSeqList ')'
+				{
+					Constraint *n = makeNode(Constraint);
+					n->contype = CONSTR_IDENTITY;
+					n->name = NULL;
+					n->raw_expr = NULL;
+					n->cooked_expr = NULL;
+					n->keys = NULL;
+					n->indexspace = NULL;
+					n->seq_opts = $2;
+					$$ = (Node *)n;
+				}
+		| /* EMPTY */
+				{
+					Constraint *n = makeNode(Constraint);
+					n->contype = CONSTR_IDENTITY;
+					n->name = NULL;
+					n->raw_expr = NULL;
+					n->cooked_expr = NULL;
+					n->keys = NULL;
+					n->indexspace = NULL;
+					n->seq_opts = NULL;
+					$$ = (Node *)n;
+				}
 		;
 
 /*
@@ -2276,6 +2344,7 @@
 					n->cooked_default = NULL;
 					n->constraints = NIL;
 					n->support = NULL;
+					n->force_default = false;
 					$$ = (Node *)n;
 				}
 		;
@@ -8468,6 +8537,7 @@
 			| AGGREGATE
 			| ALSO
 			| ALTER
+			| ALWAYS
 			| ASSERTION
 			| ASSIGNMENT
 			| AT
@@ -8527,6 +8597,7 @@
 			| FORCE
 			| FORWARD
 			| FUNCTION
+			| GENERATED
 			| GLOBAL
 			| GRANTED
 			| HANDLER
@@ -8795,6 +8866,7 @@
 			| GRANT
 			| GROUP_P
 			| HAVING
+			| IDENTITY
 			| IN_P
 			| INITIALLY
 			| INTERSECT
diff -urN pgsql.orig/src/backend/parser/keywords.c pgsql/src/backend/parser/keywords.c
--- pgsql.orig/src/backend/parser/keywords.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/parser/keywords.c	2006-08-01 07:44:34.000000000 +0200
@@ -42,6 +42,7 @@
 	{"all", ALL},
 	{"also", ALSO},
 	{"alter", ALTER},
+	{"always", ALWAYS},
 	{"analyse", ANALYSE},		/* British spelling */
 	{"analyze", ANALYZE},
 	{"and", AND},
@@ -151,6 +152,7 @@
 	{"from", FROM},
 	{"full", FULL},
 	{"function", FUNCTION},
+	{"generated", GENERATED},
 	{"global", GLOBAL},
 	{"grant", GRANT},
 	{"granted", GRANTED},
@@ -161,6 +163,7 @@
 	{"header", HEADER_P},
 	{"hold", HOLD},
 	{"hour", HOUR_P},
+	{"identity", IDENTITY},
 	{"if", IF_P},
 	{"ilike", ILIKE},
 	{"immediate", IMMEDIATE},
diff -urN pgsql.orig/src/backend/rewrite/rewriteHandler.c pgsql/src/backend/rewrite/rewriteHandler.c
--- pgsql.orig/src/backend/rewrite/rewriteHandler.c	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/backend/rewrite/rewriteHandler.c	2006-08-01 13:51:08.000000000 +0200
@@ -562,11 +562,12 @@
 			continue;
 
 		/*
-		 * Handle the two cases where we need to insert a default expression:
-		 * it's an INSERT and there's no tlist entry for the column, or the
-		 * tlist entry is a DEFAULT placeholder node.
+		 * Handle the three cases where we need to insert a default expression:
+		 * - it's an INSERT and there's no tlist entry for the column, or
+		 * - it's an INSERT and the column is GENERATED ALWAYS
+		 * - the tlist entry is a DEFAULT placeholder node
 		 */
-		if ((new_tle == NULL && commandType == CMD_INSERT) ||
+		if (((new_tle == NULL || (att_tup->atthasdef && att_tup->attforceddef)) && commandType == CMD_INSERT) ||
 			(new_tle && new_tle->expr && IsA(new_tle->expr, SetToDefault)))
 		{
 			Node	   *new_expr;
diff -urN pgsql.orig/src/bin/pg_dump/pg_dump.h pgsql/src/bin/pg_dump/pg_dump.h
--- pgsql.orig/src/bin/pg_dump/pg_dump.h	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/bin/pg_dump/pg_dump.h	2006-08-01 07:44:34.000000000 +0200
@@ -205,6 +205,7 @@
 	bool	   *attisdropped;	/* true if attr is dropped; don't dump it */
 	bool	   *attislocal;		/* true if attr has local definition */
 	bool	   *attisserial;	/* true if attr is serial or bigserial */
+	bool	   *attforceddefault;	/* true if attr is GENERATED ALWAYS */
 
 	/*
 	 * Note: we need to store per-attribute notnull, default, and constraint
diff -urN pgsql.orig/src/include/catalog/heap.h pgsql/src/include/catalog/heap.h
--- pgsql.orig/src/include/catalog/heap.h	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/include/catalog/heap.h	2006-08-01 13:21:28.000000000 +0200
@@ -21,6 +21,7 @@
 {
 	AttrNumber	attnum;			/* attribute to attach default to */
 	Node	   *raw_default;	/* default value (untransformed parse tree) */
+	bool		force_default;		/* column is GENERATED ALWAYS */
 } RawColumnDefault;
 
 typedef struct CookedConstraint
@@ -29,6 +30,7 @@
 	char	   *name;			/* name, or NULL if none */
 	AttrNumber	attnum;			/* which attr (only for DEFAULT) */
 	Node	   *expr;			/* transformed default or check expr */
+	bool		force_default;		/* GENERATED ALWAYS */
 } CookedConstraint;
 
 extern Relation heap_create(const char *relname,
@@ -71,7 +73,7 @@
 						  List *rawColDefaults,
 						  List *rawConstraints);
 
-extern void StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin);
+extern void StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin, bool attforceddef);
 
 extern Node *cookDefault(ParseState *pstate,
 			Node *raw_default,
diff -urN pgsql.orig/src/include/catalog/pg_attribute.h pgsql/src/include/catalog/pg_attribute.h
--- pgsql.orig/src/include/catalog/pg_attribute.h	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/include/catalog/pg_attribute.h	2006-08-01 07:44:34.000000000 +0200
@@ -149,6 +149,9 @@
 
 	/* Number of times inherited from direct parent relation(s) */
 	int4		attinhcount;
+
+	/* GENERATED ALWAYS */
+	bool		attforceddef;
 } FormData_pg_attribute;
 
 /*
@@ -157,7 +160,7 @@
  * because of alignment padding at the end of the struct.)
  */
 #define ATTRIBUTE_TUPLE_SIZE \
-	(offsetof(FormData_pg_attribute,attinhcount) + sizeof(int4))
+	(offsetof(FormData_pg_attribute,attforceddef) + sizeof(bool))
 
 /* ----------------
  *		Form_pg_attribute corresponds to a pointer to a tuple with
@@ -171,7 +174,7 @@
  * ----------------
  */
 
-#define Natts_pg_attribute				17
+#define Natts_pg_attribute				18
 #define Anum_pg_attribute_attrelid		1
 #define Anum_pg_attribute_attname		2
 #define Anum_pg_attribute_atttypid		3
@@ -189,6 +192,7 @@
 #define Anum_pg_attribute_attisdropped	15
 #define Anum_pg_attribute_attislocal	16
 #define Anum_pg_attribute_attinhcount	17
+#define Anum_pg_attribute_attforceddef	18
 
 
 
@@ -222,228 +226,231 @@
  * ----------------
  */
 #define Schema_pg_type \
-{ 1247, {"typname"},	   19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typnamespace"},  26, -1,	4,	2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typowner"},	   26, -1,	4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typlen"},		   21, -1,	2,	4, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 1247, {"typbyval"},	   16, -1,	1,	5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1247, {"typtype"},	   18, -1,	1,	6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1247, {"typisdefined"},  16, -1,	1,	7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1247, {"typdelim"},	   18, -1,	1,	8, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1247, {"typrelid"},	   26, -1,	4,	9, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typelem"},	   26, -1,	4, 10, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typinput"},	   24, -1,	4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typoutput"},	   24, -1,	4, 12, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typreceive"},    24, -1,	4, 13, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typsend"},	   24, -1,	4, 14, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typanalyze"},    24, -1,	4, 15, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typalign"},	   18, -1,	1, 16, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1247, {"typstorage"},    18, -1,	1, 17, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1247, {"typnotnull"},    16, -1,	1, 18, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1247, {"typbasetype"},   26, -1,	4, 19, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typtypmod"},	   23, -1,	4, 20, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typndims"},	   23, -1,	4, 21, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1247, {"typdefaultbin"}, 25, -1, -1, 22, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \
-{ 1247, {"typdefault"},    25, -1, -1, 23, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 }
-
-DATA(insert ( 1247 typname			19 -1 NAMEDATALEN	1 0 -1 -1 f p i t f f t 0));
-DATA(insert ( 1247 typnamespace		26 -1 4   2 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typowner			26 -1 4   3 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typlen			21 -1 2   4 0 -1 -1 t p s t f f t 0));
-DATA(insert ( 1247 typbyval			16 -1 1   5 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1247 typtype			18 -1 1   6 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1247 typisdefined		16 -1 1   7 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1247 typdelim			18 -1 1   8 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1247 typrelid			26 -1 4   9 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typelem			26 -1 4  10 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typinput			24 -1 4  11 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typoutput		24 -1 4  12 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typreceive		24 -1 4  13 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typsend			24 -1 4  14 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typanalyze		24 -1 4  15 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typalign			18 -1 1  16 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1247 typstorage		18 -1 1  17 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1247 typnotnull		16 -1 1  18 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1247 typbasetype		26 -1 4  19 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typtypmod		23 -1 4  20 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typndims			23 -1 4  21 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 typdefaultbin	25 -1 -1 22 0 -1 -1 f x i f f f t 0));
-DATA(insert ( 1247 typdefault		25 -1 -1 23 0 -1 -1 f x i f f f t 0));
-DATA(insert ( 1247 ctid				27 0  6  -1 0 -1 -1 f p s t f f t 0));
-DATA(insert ( 1247 oid				26 0  4  -2 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 xmin				28 0  4  -3 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 cmin				29 0  4  -4 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 xmax				28 0  4  -5 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 cmax				29 0  4  -6 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1247 tableoid			26 0  4  -7 0 -1 -1 t p i t f f t 0));
+{ 1247, {"typname"},	   19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typnamespace"},  26, -1,	4,	2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typowner"},	   26, -1,	4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typlen"},		   21, -1,	2,	4, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 1247, {"typbyval"},	   16, -1,	1,	5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1247, {"typtype"},	   18, -1,	1,	6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1247, {"typisdefined"},  16, -1,	1,	7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1247, {"typdelim"},	   18, -1,	1,	8, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1247, {"typrelid"},	   26, -1,	4,	9, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typelem"},	   26, -1,	4, 10, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typinput"},	   24, -1,	4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typoutput"},	   24, -1,	4, 12, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typreceive"},    24, -1,	4, 13, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typsend"},	   24, -1,	4, 14, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typanalyze"},    24, -1,	4, 15, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typalign"},	   18, -1,	1, 16, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1247, {"typstorage"},    18, -1,	1, 17, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1247, {"typnotnull"},    16, -1,	1, 18, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1247, {"typbasetype"},   26, -1,	4, 19, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typtypmod"},	   23, -1,	4, 20, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typndims"},	   23, -1,	4, 21, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1247, {"typdefaultbin"}, 25, -1, -1, 22, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }, \
+{ 1247, {"typdefault"},    25, -1, -1, 23, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }
+
+DATA(insert ( 1247 typname			19 -1 NAMEDATALEN	1 0 -1 -1 f p i t f f t 0 f));
+DATA(insert ( 1247 typnamespace		26 -1 4   2 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typowner			26 -1 4   3 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typlen			21 -1 2   4 0 -1 -1 t p s t f f t 0 f));
+DATA(insert ( 1247 typbyval			16 -1 1   5 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1247 typtype			18 -1 1   6 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1247 typisdefined		16 -1 1   7 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1247 typdelim			18 -1 1   8 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1247 typrelid			26 -1 4   9 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typelem			26 -1 4  10 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typinput			24 -1 4  11 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typoutput		24 -1 4  12 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typreceive		24 -1 4  13 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typsend			24 -1 4  14 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typanalyze		24 -1 4  15 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typalign			18 -1 1  16 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1247 typstorage		18 -1 1  17 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1247 typnotnull		16 -1 1  18 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1247 typbasetype		26 -1 4  19 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typtypmod		23 -1 4  20 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typndims			23 -1 4  21 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 typdefaultbin	25 -1 -1 22 0 -1 -1 f x i f f f t 0 f));
+DATA(insert ( 1247 typdefault		25 -1 -1 23 0 -1 -1 f x i f f f t 0 f));
+DATA(insert ( 1247 ctid				27 0  6  -1 0 -1 -1 f p s t f f t 0 f));
+DATA(insert ( 1247 oid				26 0  4  -2 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 xmin				28 0  4  -3 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 cmin				29 0  4  -4 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 xmax				28 0  4  -5 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 cmax				29 0  4  -6 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1247 tableoid			26 0  4  -7 0 -1 -1 t p i t f f t 0 f));
 
 /* ----------------
  *		pg_proc
  * ----------------
  */
 #define Schema_pg_proc \
-{ 1255, {"proname"},			19, -1, NAMEDATALEN,  1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
-{ 1255, {"pronamespace"},		26, -1, 4,	2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1255, {"proowner"},			26, -1, 4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1255, {"prolang"},			26, -1, 4,	4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1255, {"proisagg"},			16, -1, 1,	5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1255, {"prosecdef"},			16, -1, 1,	6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1255, {"proisstrict"},		16, -1, 1,	7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1255, {"proretset"},			16, -1, 1,	8, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1255, {"provolatile"},		18, -1, 1,	9, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1255, {"pronargs"},			21, -1, 2, 10, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 1255, {"prorettype"},			26, -1, 4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1255, {"proargtypes"},		30, -1, -1, 12, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
-{ 1255, {"proallargtypes"},   1028, -1, -1, 13, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \
-{ 1255, {"proargmodes"},	  1002, -1, -1, 14, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \
-{ 1255, {"proargnames"},	  1009, -1, -1, 15, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \
-{ 1255, {"prosrc"},				25, -1, -1, 16, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \
-{ 1255, {"probin"},				17, -1, -1, 17, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \
-{ 1255, {"proacl"},			  1034, -1, -1, 18, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0 }
-
-DATA(insert ( 1255 proname			19 -1 NAMEDATALEN	1 0 -1 -1 f p i t f f t 0));
-DATA(insert ( 1255 pronamespace		26 -1 4   2 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1255 proowner			26 -1 4   3 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1255 prolang			26 -1 4   4 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1255 proisagg			16 -1 1   5 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1255 prosecdef		16 -1 1   6 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1255 proisstrict		16 -1 1   7 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1255 proretset		16 -1 1   8 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1255 provolatile		18 -1 1   9 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1255 pronargs			21 -1 2  10 0 -1 -1 t p s t f f t 0));
-DATA(insert ( 1255 prorettype		26 -1 4  11 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1255 proargtypes		30 -1 -1 12 1 -1 -1 f p i t f f t 0));
-DATA(insert ( 1255 proallargtypes 1028 -1 -1 13 1 -1 -1 f x i f f f t 0));
-DATA(insert ( 1255 proargmodes	  1002 -1 -1 14 1 -1 -1 f x i f f f t 0));
-DATA(insert ( 1255 proargnames	  1009 -1 -1 15 1 -1 -1 f x i f f f t 0));
-DATA(insert ( 1255 prosrc			25 -1 -1 16 0 -1 -1 f x i f f f t 0));
-DATA(insert ( 1255 probin			17 -1 -1 17 0 -1 -1 f x i f f f t 0));
-DATA(insert ( 1255 proacl		  1034 -1 -1 18 1 -1 -1 f x i f f f t 0));
-DATA(insert ( 1255 ctid				27 0  6  -1 0 -1 -1 f p s t f f t 0));
-DATA(insert ( 1255 oid				26 0  4  -2 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1255 xmin				28 0  4  -3 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1255 cmin				29 0  4  -4 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1255 xmax				28 0  4  -5 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1255 cmax				29 0  4  -6 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1255 tableoid			26 0  4  -7 0 -1 -1 t p i t f f t 0));
+{ 1255, {"proname"},			19, -1, NAMEDATALEN,  1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1255, {"pronamespace"},		26, -1, 4,	2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1255, {"proowner"},			26, -1, 4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1255, {"prolang"},			26, -1, 4,	4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1255, {"proisagg"},			16, -1, 1,	5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1255, {"prosecdef"},			16, -1, 1,	6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1255, {"proisstrict"},		16, -1, 1,	7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1255, {"proretset"},			16, -1, 1,	8, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1255, {"provolatile"},		18, -1, 1,	9, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1255, {"pronargs"},			21, -1, 2, 10, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 1255, {"prorettype"},			26, -1, 4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1255, {"proargtypes"},		30, -1, -1, 12, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1255, {"proallargtypes"},   1028, -1, -1, 13, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }, \
+{ 1255, {"proargmodes"},	  1002, -1, -1, 14, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }, \
+{ 1255, {"proargnames"},	  1009, -1, -1, 15, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }, \
+{ 1255, {"prosrc"},				25, -1, -1, 16, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }, \
+{ 1255, {"probin"},				17, -1, -1, 17, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }, \
+{ 1255, {"proacl"},			  1034, -1, -1, 18, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }
+
+DATA(insert ( 1255 proname			19 -1 NAMEDATALEN	1 0 -1 -1 f p i t f f t 0 f));
+DATA(insert ( 1255 pronamespace		26 -1 4   2 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1255 proowner			26 -1 4   3 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1255 prolang			26 -1 4   4 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1255 proisagg			16 -1 1   5 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1255 prosecdef		16 -1 1   6 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1255 proisstrict		16 -1 1   7 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1255 proretset		16 -1 1   8 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1255 provolatile		18 -1 1   9 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1255 pronargs			21 -1 2  10 0 -1 -1 t p s t f f t 0 f));
+DATA(insert ( 1255 prorettype		26 -1 4  11 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1255 proargtypes		30 -1 -1 12 1 -1 -1 f p i t f f t 0 f));
+DATA(insert ( 1255 proallargtypes 1028 -1 -1 13 1 -1 -1 f x i f f f t 0 f));
+DATA(insert ( 1255 proargmodes	  1002 -1 -1 14 1 -1 -1 f x i f f f t 0 f));
+DATA(insert ( 1255 proargnames	  1009 -1 -1 15 1 -1 -1 f x i f f f t 0 f));
+DATA(insert ( 1255 prosrc			25 -1 -1 16 0 -1 -1 f x i f f f t 0 f));
+DATA(insert ( 1255 probin			17 -1 -1 17 0 -1 -1 f x i f f f t 0 f));
+DATA(insert ( 1255 proacl		  1034 -1 -1 18 1 -1 -1 f x i f f f t 0 f));
+DATA(insert ( 1255 ctid				27 0  6  -1 0 -1 -1 f p s t f f t 0 f));
+DATA(insert ( 1255 oid				26 0  4  -2 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1255 xmin				28 0  4  -3 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1255 cmin				29 0  4  -4 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1255 xmax				28 0  4  -5 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1255 cmax				29 0  4  -6 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1255 tableoid			26 0  4  -7 0 -1 -1 t p i t f f t 0 f));
 
 /* ----------------
  *		pg_attribute
  * ----------------
  */
 #define Schema_pg_attribute \
-{ 1249, {"attrelid"},	  26, -1,	4,	1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1249, {"attname"},	  19, -1, NAMEDATALEN,	2, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
-{ 1249, {"atttypid"},	  26, -1,	4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1249, {"attstattarget"}, 23, -1,	4,	4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1249, {"attlen"},		  21, -1,	2,	5, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 1249, {"attnum"},		  21, -1,	2,	6, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 1249, {"attndims"},	  23, -1,	4,	7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1249, {"attcacheoff"},  23, -1,	4,	8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1249, {"atttypmod"},	  23, -1,	4,	9, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1249, {"attbyval"},	  16, -1,	1, 10, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1249, {"attstorage"},   18, -1,	1, 11, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1249, {"attalign"},	  18, -1,	1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1249, {"attnotnull"},   16, -1,	1, 13, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1249, {"atthasdef"},	  16, -1,	1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1249, {"attisdropped"}, 16, -1,	1, 15, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1249, {"attislocal"},   16, -1,	1, 16, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1249, {"attinhcount"},  23, -1,	4, 17, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }
-
-DATA(insert ( 1249 attrelid			26 -1  4   1 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 attname			19 -1 NAMEDATALEN  2 0 -1 -1 f p i t f f t 0));
-DATA(insert ( 1249 atttypid			26 -1  4   3 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 attstattarget	23 -1  4   4 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 attlen			21 -1  2   5 0 -1 -1 t p s t f f t 0));
-DATA(insert ( 1249 attnum			21 -1  2   6 0 -1 -1 t p s t f f t 0));
-DATA(insert ( 1249 attndims			23 -1  4   7 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 attcacheoff		23 -1  4   8 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 atttypmod		23 -1  4   9 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 attbyval			16 -1  1  10 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1249 attstorage		18 -1  1  11 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1249 attalign			18 -1  1  12 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1249 attnotnull		16 -1  1  13 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1249 atthasdef		16 -1  1  14 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1249 attisdropped		16 -1  1  15 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1249 attislocal		16 -1  1  16 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1249 attinhcount		23 -1  4  17 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 ctid				27 0  6  -1 0 -1 -1 f p s t f f t 0));
+{ 1249, {"attrelid"},	  26, -1,	4,	1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1249, {"attname"},	  19, -1, NAMEDATALEN,	2, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1249, {"atttypid"},	  26, -1,	4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1249, {"attstattarget"}, 23, -1,	4,	4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1249, {"attlen"},		  21, -1,	2,	5, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 1249, {"attnum"},		  21, -1,	2,	6, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 1249, {"attndims"},	  23, -1,	4,	7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1249, {"attcacheoff"},  23, -1,	4,	8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1249, {"atttypmod"},	  23, -1,	4,	9, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1249, {"attbyval"},	  16, -1,	1, 10, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1249, {"attstorage"},   18, -1,	1, 11, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1249, {"attalign"},	  18, -1,	1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1249, {"attnotnull"},   16, -1,	1, 13, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1249, {"atthasdef"},	  16, -1,	1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1249, {"attisdropped"}, 16, -1,	1, 15, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1249, {"attislocal"},   16, -1,	1, 16, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1249, {"attinhcount"},  23, -1,	4, 17, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1249, {"attforceddef"}, 16, -1,       1, 18, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }
+
+
+DATA(insert ( 1249 attrelid			26 -1  4   1 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 attname			19 -1 NAMEDATALEN  2 0 -1 -1 f p i t f f t 0 f));
+DATA(insert ( 1249 atttypid			26 -1  4   3 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 attstattarget	23 -1  4   4 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 attlen			21 -1  2   5 0 -1 -1 t p s t f f t 0 f));
+DATA(insert ( 1249 attnum			21 -1  2   6 0 -1 -1 t p s t f f t 0 f));
+DATA(insert ( 1249 attndims			23 -1  4   7 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 attcacheoff		23 -1  4   8 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 atttypmod		23 -1  4   9 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 attbyval			16 -1  1  10 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1249 attstorage		18 -1  1  11 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1249 attalign			18 -1  1  12 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1249 attnotnull		16 -1  1  13 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1249 atthasdef		16 -1  1  14 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1249 attisdropped		16 -1  1  15 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1249 attislocal		16 -1  1  16 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1249 attinhcount		23 -1  4  17 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 attforceddef		16 -1  1  18 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1249 ctid				27 0  6  -1 0 -1 -1 f p s t f f t 0 f));
 /* no OIDs in pg_attribute */
-DATA(insert ( 1249 xmin				28 0  4  -3 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 cmin				29 0  4  -4 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 xmax				28 0  4  -5 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 cmax				29 0  4  -6 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1249 tableoid			26 0  4  -7 0 -1 -1 t p i t f f t 0));
+DATA(insert ( 1249 xmin				28 0  4  -3 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 cmin				29 0  4  -4 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 xmax				28 0  4  -5 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 cmax				29 0  4  -6 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1249 tableoid			26 0  4  -7 0 -1 -1 t p i t f f t 0 f));
 
 /* ----------------
  *		pg_class
  * ----------------
  */
 #define Schema_pg_class \
-{ 1259, {"relname"},	   19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"relnamespace"},  26, -1,	4,	2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"reltype"},	   26, -1,	4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"relowner"},	   26, -1,	4,	4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"relam"},		   26, -1,	4,	5, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"relfilenode"},   26, -1,	4,	6, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"reltablespace"}, 26, -1,	4,	7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"relpages"},	   23, -1,	4,	8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"reltuples"},	   700, -1, 4,	9, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"reltoastrelid"}, 26, -1,	4, 10, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"reltoastidxid"}, 26, -1,	4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"relhasindex"},   16, -1,	1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1259, {"relisshared"},   16, -1,	1, 13, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1259, {"relkind"},	   18, -1,	1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1259, {"relnatts"},	   21, -1,	2, 15, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 1259, {"relchecks"},	   21, -1,	2, 16, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 1259, {"reltriggers"},   21, -1,	2, 17, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 1259, {"relukeys"},	   21, -1,	2, 18, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 1259, {"relfkeys"},	   21, -1,	2, 19, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 1259, {"relrefs"},	   21, -1,	2, 20, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 1259, {"relhasoids"},    16, -1,	1, 21, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1259, {"relhaspkey"},    16, -1,	1, 22, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1259, {"relhasrules"},   16, -1,	1, 23, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1259, {"relhassubclass"},16, -1,	1, 24, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 1259, {"relminxid"},     28, -1,	4, 25, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"relvacuumxid"},  28, -1,	4, 26, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 1259, {"relacl"},		 1034, -1, -1, 27, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \
-{ 1259, {"reloptions"},  1009, -1, -1, 28, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0 }
-
-DATA(insert ( 1259 relname			19 -1 NAMEDATALEN	1 0 -1 -1 f p i t f f t 0));
-DATA(insert ( 1259 relnamespace		26 -1 4   2 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 reltype			26 -1 4   3 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 relowner			26 -1 4   4 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 relam			26 -1 4   5 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 relfilenode		26 -1 4   6 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 reltablespace	26 -1 4   7 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 relpages			23 -1 4   8 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 reltuples	   700 -1 4   9 0 -1 -1 f p i t f f t 0));
-DATA(insert ( 1259 reltoastrelid	26 -1 4  10 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 reltoastidxid	26 -1 4  11 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 relhasindex		16 -1 1  12 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1259 relisshared		16 -1 1  13 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1259 relkind			18 -1 1  14 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1259 relnatts			21 -1 2  15 0 -1 -1 t p s t f f t 0));
-DATA(insert ( 1259 relchecks		21 -1 2  16 0 -1 -1 t p s t f f t 0));
-DATA(insert ( 1259 reltriggers		21 -1 2  17 0 -1 -1 t p s t f f t 0));
-DATA(insert ( 1259 relukeys			21 -1 2  18 0 -1 -1 t p s t f f t 0));
-DATA(insert ( 1259 relfkeys			21 -1 2  19 0 -1 -1 t p s t f f t 0));
-DATA(insert ( 1259 relrefs			21 -1 2  20 0 -1 -1 t p s t f f t 0));
-DATA(insert ( 1259 relhasoids		16 -1 1  21 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1259 relhaspkey		16 -1 1  22 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1259 relhasrules		16 -1 1  23 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1259 relhassubclass	16 -1 1  24 0 -1 -1 t p c t f f t 0));
-DATA(insert ( 1259 relminxid		28 -1 4  25 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 relvacuumxid		28 -1 4  26 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 relacl		  1034 -1 -1 27 1 -1 -1 f x i f f f t 0));
-DATA(insert ( 1259 reloptions	  1009 -1 -1 28 1 -1 -1 f x i f f f t 0));
-DATA(insert ( 1259 ctid				27 0  6  -1 0 -1 -1 f p s t f f t 0));
-DATA(insert ( 1259 oid				26 0  4  -2 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 xmin				28 0  4  -3 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 cmin				29 0  4  -4 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 xmax				28 0  4  -5 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 cmax				29 0  4  -6 0 -1 -1 t p i t f f t 0));
-DATA(insert ( 1259 tableoid			26 0  4  -7 0 -1 -1 t p i t f f t 0));
+{ 1259, {"relname"},	   19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"relnamespace"},  26, -1,	4,	2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"reltype"},	   26, -1,	4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"relowner"},	   26, -1,	4,	4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"relam"},		   26, -1,	4,	5, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"relfilenode"},   26, -1,	4,	6, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"reltablespace"}, 26, -1,	4,	7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"relpages"},	   23, -1,	4,	8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"reltuples"},	   700, -1, 4,	9, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"reltoastrelid"}, 26, -1,	4, 10, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"reltoastidxid"}, 26, -1,	4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"relhasindex"},   16, -1,	1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1259, {"relisshared"},   16, -1,	1, 13, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1259, {"relkind"},	   18, -1,	1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1259, {"relnatts"},	   21, -1,	2, 15, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 1259, {"relchecks"},	   21, -1,	2, 16, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 1259, {"reltriggers"},   21, -1,	2, 17, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 1259, {"relukeys"},	   21, -1,	2, 18, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 1259, {"relfkeys"},	   21, -1,	2, 19, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 1259, {"relrefs"},	   21, -1,	2, 20, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 1259, {"relhasoids"},    16, -1,	1, 21, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1259, {"relhaspkey"},    16, -1,	1, 22, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1259, {"relhasrules"},   16, -1,	1, 23, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1259, {"relhassubclass"},16, -1,	1, 24, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 1259, {"relminxid"},     28, -1,	4, 25, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"relvacuumxid"},  28, -1,	4, 26, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 1259, {"relacl"},		 1034, -1, -1, 27, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }, \
+{ 1259, {"reloptions"},  1009, -1, -1, 28, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }
+
+DATA(insert ( 1259 relname			19 -1 NAMEDATALEN	1 0 -1 -1 f p i t f f t 0 f));
+DATA(insert ( 1259 relnamespace		26 -1 4   2 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 reltype			26 -1 4   3 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 relowner			26 -1 4   4 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 relam			26 -1 4   5 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 relfilenode		26 -1 4   6 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 reltablespace	26 -1 4   7 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 relpages			23 -1 4   8 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 reltuples	   700 -1 4   9 0 -1 -1 f p i t f f t 0 f));
+DATA(insert ( 1259 reltoastrelid	26 -1 4  10 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 reltoastidxid	26 -1 4  11 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 relhasindex		16 -1 1  12 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1259 relisshared		16 -1 1  13 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1259 relkind			18 -1 1  14 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1259 relnatts			21 -1 2  15 0 -1 -1 t p s t f f t 0 f));
+DATA(insert ( 1259 relchecks		21 -1 2  16 0 -1 -1 t p s t f f t 0 f));
+DATA(insert ( 1259 reltriggers		21 -1 2  17 0 -1 -1 t p s t f f t 0 f));
+DATA(insert ( 1259 relukeys			21 -1 2  18 0 -1 -1 t p s t f f t 0 f));
+DATA(insert ( 1259 relfkeys			21 -1 2  19 0 -1 -1 t p s t f f t 0 f));
+DATA(insert ( 1259 relrefs			21 -1 2  20 0 -1 -1 t p s t f f t 0 f));
+DATA(insert ( 1259 relhasoids		16 -1 1  21 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1259 relhaspkey		16 -1 1  22 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1259 relhasrules		16 -1 1  23 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1259 relhassubclass	16 -1 1  24 0 -1 -1 t p c t f f t 0 f));
+DATA(insert ( 1259 relminxid		28 -1 4  25 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 relvacuumxid		28 -1 4  26 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 relacl		  1034 -1 -1 27 1 -1 -1 f x i f f f t 0 f));
+DATA(insert ( 1259 reloptions	  1009 -1 -1 28 1 -1 -1 f x i f f f t 0 f));
+DATA(insert ( 1259 ctid				27 0  6  -1 0 -1 -1 f p s t f f t 0 f));
+DATA(insert ( 1259 oid				26 0  4  -2 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 xmin				28 0  4  -3 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 cmin				29 0  4  -4 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 xmax				28 0  4  -5 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 cmax				29 0  4  -6 0 -1 -1 t p i t f f t 0 f));
+DATA(insert ( 1259 tableoid			26 0  4  -7 0 -1 -1 t p i t f f t 0 f));
 
 /* ----------------
  *		pg_index
@@ -454,15 +461,15 @@
  * ----------------
  */
 #define Schema_pg_index \
-{ 0, {"indexrelid"},		26, -1, 4, 1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 0, {"indrelid"},			26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
-{ 0, {"indnatts"},			21, -1, 2, 3, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \
-{ 0, {"indisunique"},		16, -1, 1, 4, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 0, {"indisprimary"},		16, -1, 1, 5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 0, {"indisclustered"},	16, -1, 1, 6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \
-{ 0, {"indkey"},			22, -1, -1, 7, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
-{ 0, {"indclass"},			30, -1, -1, 8, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \
-{ 0, {"indexprs"},			25, -1, -1, 9, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 }, \
-{ 0, {"indpred"},			25, -1, -1, 10, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0 }
+{ 0, {"indexrelid"},		26, -1, 4, 1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 0, {"indrelid"},			26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, false }, \
+{ 0, {"indnatts"},			21, -1, 2, 3, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, false }, \
+{ 0, {"indisunique"},		16, -1, 1, 4, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 0, {"indisprimary"},		16, -1, 1, 5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 0, {"indisclustered"},	16, -1, 1, 6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, false }, \
+{ 0, {"indkey"},			22, -1, -1, 7, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0, false }, \
+{ 0, {"indclass"},			30, -1, -1, 8, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0, false }, \
+{ 0, {"indexprs"},			25, -1, -1, 9, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }, \
+{ 0, {"indpred"},			25, -1, -1, 10, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, false }
 
 #endif   /* PG_ATTRIBUTE_H */
diff -urN pgsql.orig/src/include/catalog/pg_class.h pgsql/src/include/catalog/pg_class.h
--- pgsql.orig/src/include/catalog/pg_class.h	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/include/catalog/pg_class.h	2006-08-01 07:44:34.000000000 +0200
@@ -135,7 +135,7 @@
 /* Note: the "3" here stands for FirstNormalTransactionId */
 DATA(insert OID = 1247 (  pg_type		PGNSP 71 PGUID 0 1247 0 0 0 0 0 f f r 23 0 0 0 0 0 t f f f 3 3 _null_ _null_ ));
 DESCR("");
-DATA(insert OID = 1249 (  pg_attribute	PGNSP 75 PGUID 0 1249 0 0 0 0 0 f f r 17 0 0 0 0 0 f f f f 3 3 _null_ _null_ ));
+DATA(insert OID = 1249 (  pg_attribute	PGNSP 75 PGUID 0 1249 0 0 0 0 0 f f r 18 0 0 0 0 0 f f f f 3 3 _null_ _null_ ));
 DESCR("");
 DATA(insert OID = 1255 (  pg_proc		PGNSP 81 PGUID 0 1255 0 0 0 0 0 f f r 18 0 0 0 0 0 t f f f 3 3 _null_ _null_ ));
 DESCR("");
diff -urN pgsql.orig/src/include/nodes/parsenodes.h pgsql/src/include/nodes/parsenodes.h
--- pgsql.orig/src/include/nodes/parsenodes.h	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/include/nodes/parsenodes.h	2006-08-01 07:44:34.000000000 +0200
@@ -394,6 +394,7 @@
 	char	   *cooked_default; /* nodeToString representation */
 	List	   *constraints;	/* other constraints on column */
 	RangeVar   *support;		/* supporting relation, if any */
+	bool		force_default;	/* GENERATED ALWAYS */
 } ColumnDef;
 
 /*
@@ -1063,7 +1064,8 @@
 	CONSTR_ATTR_DEFERRABLE,		/* attributes for previous constraint node */
 	CONSTR_ATTR_NOT_DEFERRABLE,
 	CONSTR_ATTR_DEFERRED,
-	CONSTR_ATTR_IMMEDIATE
+	CONSTR_ATTR_IMMEDIATE,
+	CONSTR_IDENTITY
 } ConstrType;
 
 typedef struct Constraint
@@ -1077,6 +1079,8 @@
 	List	   *options;		/* options from WITH clause */
 	char	   *indexspace;		/* index tablespace for PKEY/UNIQUE
 								 * constraints; NULL for default */
+	bool		force_default;	/* GENERATED ALWAYS */
+	List	   *seq_opts;		/* SEQUENCE options for GENERATED ... AS IDENTITY */
 } Constraint;
 
 /* ----------
diff -urN pgsql.orig/src/test/regress/expected/identity.out pgsql/src/test/regress/expected/identity.out
--- pgsql.orig/src/test/regress/expected/identity.out	1970-01-01 01:00:00.000000000 +0100
+++ pgsql/src/test/regress/expected/identity.out	2006-08-01 14:03:51.000000000 +0200
@@ -0,0 +1,226 @@
+--
+-- IDENTITY
+--  2006.08.01 Zoltan Boszormeny <zboszor@dunaweb.hu>
+--
+--
+-- Test GENERATED BY DEFAULT AS IDENTITY with default sequence
+--
+create table id (id serial generated by default as identity primary key, name text);
+NOTICE:  CREATE TABLE will create implicit sequence "id_id_seq" for serial column "id.id"
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "id_pkey" for table "id"
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+--
+-- This must complain about UNIQUE violation
+--
+insert into id (id, name) values (0, 'a');
+ERROR:  duplicate key violates unique constraint "id_pkey"
+select * from id;
+ id | name 
+----+------
+  1 | a
+  2 | a
+  3 | a
+  0 | a
+(4 rows)
+
+drop table id;
+--
+-- Test GENERATED BY DEFAULT AS IDENTITY with modified sequence
+--
+create table id (id serial generated by default as identity(start 3) primary key, name text);
+NOTICE:  CREATE TABLE will create implicit sequence "id_id_seq" for serial column "id.id"
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "id_pkey" for table "id"
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+--
+-- This must complain about UNIQUE violation
+--
+insert into id (id, name) values (0, 'a');
+ERROR:  duplicate key violates unique constraint "id_pkey"
+select * from id;
+ id | name 
+----+------
+  3 | a
+  4 | a
+  5 | a
+  0 | a
+(4 rows)
+
+drop table id;
+--
+-- Test GENERATED ALWAYS AS IDENTITY with default sequence
+--
+create table id (id serial generated always as identity primary key, name text);
+NOTICE:  CREATE TABLE will create implicit sequence "id_id_seq" for serial column "id.id"
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "id_pkey" for table "id"
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+insert into id (id, name) values (0, 'a');
+insert into id (id, name) values (0, 'a');
+select * from id;
+ id | name 
+----+------
+  1 | a
+  2 | a
+  3 | a
+  4 | a
+  5 | a
+  6 | a
+(6 rows)
+
+--
+-- It should update 0 rows
+--
+update id set name = 'b' where id = 0;
+select * from id;
+ id | name 
+----+------
+  1 | a
+  2 | a
+  3 | a
+  4 | a
+  5 | a
+  6 | a
+(6 rows)
+
+drop table id;
+--
+-- Test GENERATED ALWAYS AS IDENTITY with modified sequence
+--
+create table id (id serial generated always as identity(start 3) primary key, name text);
+NOTICE:  CREATE TABLE will create implicit sequence "id_id_seq" for serial column "id.id"
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "id_pkey" for table "id"
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+insert into id (id, name) values (0, 'a');
+insert into id (id, name) values (0, 'a');
+select * from id;
+ id | name 
+----+------
+  3 | a
+  4 | a
+  5 | a
+  6 | a
+  7 | a
+  8 | a
+(6 rows)
+
+--
+-- It should update 0 rows
+--
+update id set name = 'b' where id = 0;
+select * from id;
+ id | name 
+----+------
+  3 | a
+  4 | a
+  5 | a
+  6 | a
+  7 | a
+  8 | a
+(6 rows)
+
+drop table id;
+--
+-- Test GENERATED BY DEFAULT AS (expr)
+-- It must give a syntax error but drop it anyway.
+--
+create table id (id integer generated by default as (1), name text);
+ERROR:  syntax error at or near "("
+LINE 1: ...eate table id (id integer generated by default as (1), name ...
+                                                             ^
+drop table id;
+ERROR:  table "id" does not exist
+--
+-- Test GENERATED ALWAYS AS ( expr )
+--
+create table id (id integer generated always as (1), name text);
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+select * from id;
+ id | name 
+----+------
+  1 | a
+  1 | a
+(2 rows)
+
+--
+-- It should update 0 rows
+--
+update id set name = 'b' where id = 0;
+select * from id;
+ id | name 
+----+------
+  1 | a
+  1 | a
+(2 rows)
+
+drop table id;
+--
+-- Test IDENTITY with non-integer columns
+--
+create table id (id decimal(10,2) generated always as identity(start 3), name text);
+NOTICE:  CREATE TABLE will create implicit sequence "id_id_seq" for serial column "id.id"
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+select * from id;
+  id  | name 
+------+------
+ 3.00 | a
+ 4.00 | a
+(2 rows)
+
+alter table id alter id type real;
+insert into id (id, name) values (0, 'a');
+select * from id;
+ id | name 
+----+------
+  3 | a
+  4 | a
+  5 | a
+(3 rows)
+
+alter table id alter id type integer;
+insert into id (id, name) values (0, 'a');
+select * from id;
+ id | name 
+----+------
+  3 | a
+  4 | a
+  5 | a
+  6 | a
+(4 rows)
+
+--
+-- It should update 0 rows
+--
+update id set name = 'b' where id = 0;
+select * from id;
+ id | name 
+----+------
+  3 | a
+  4 | a
+  5 | a
+  6 | a
+(4 rows)
+
+update id set name = 'b' where id = 5;
+select * from id;
+ id | name 
+----+------
+  3 | a
+  4 | a
+  6 | a
+  5 | b
+(4 rows)
+
+drop table id;
diff -urN pgsql.orig/src/test/regress/identity_schedule pgsql/src/test/regress/identity_schedule
--- pgsql.orig/src/test/regress/identity_schedule	1970-01-01 01:00:00.000000000 +0100
+++ pgsql/src/test/regress/identity_schedule	2006-08-01 11:05:42.000000000 +0200
@@ -0,0 +1,6 @@
+# ----------
+# The first group of parallel test
+# $PostgreSQL: pgsql/src/test/regress/parallel_schedule,v 1.32 2006/03/11 04:38:41 momjian Exp $
+# ----------
+test: identity
+
diff -urN pgsql.orig/src/test/regress/parallel_schedule pgsql/src/test/regress/parallel_schedule
--- pgsql.orig/src/test/regress/parallel_schedule	2006-08-01 00:00:00.000000000 +0200
+++ pgsql/src/test/regress/parallel_schedule	2006-08-01 13:53:41.000000000 +0200
@@ -2,7 +2,7 @@
 # The first group of parallel test
 # $PostgreSQL: pgsql/src/test/regress/parallel_schedule,v 1.32 2006/03/11 04:38:41 momjian Exp $
 # ----------
-test: boolean char name varchar text int2 int4 int8 oid float4 float8 bit numeric
+test: boolean char name varchar text int2 int4 int8 oid float4 float8 bit numeric identity
 
 # Depends on things setup during char, varchar and text
 test: strings
diff -urN pgsql.orig/src/test/regress/sql/identity.sql pgsql/src/test/regress/sql/identity.sql
--- pgsql.orig/src/test/regress/sql/identity.sql	1970-01-01 01:00:00.000000000 +0100
+++ pgsql/src/test/regress/sql/identity.sql	2006-08-01 14:03:27.000000000 +0200
@@ -0,0 +1,120 @@
+--
+-- IDENTITY
+--  2006.08.01 Zoltan Boszormeny <zboszor@dunaweb.hu>
+--
+
+--
+-- Test GENERATED BY DEFAULT AS IDENTITY with default sequence
+--
+
+create table id (id serial generated by default as identity primary key, name text);
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+--
+-- This must complain about UNIQUE violation
+--
+insert into id (id, name) values (0, 'a');
+select * from id;
+drop table id;
+
+--
+-- Test GENERATED BY DEFAULT AS IDENTITY with modified sequence
+--
+
+create table id (id serial generated by default as identity(start 3) primary key, name text);
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+--
+-- This must complain about UNIQUE violation
+--
+insert into id (id, name) values (0, 'a');
+select * from id;
+drop table id;
+
+--
+-- Test GENERATED ALWAYS AS IDENTITY with default sequence
+--
+
+create table id (id serial generated always as identity primary key, name text);
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+insert into id (id, name) values (0, 'a');
+insert into id (id, name) values (0, 'a');
+select * from id;
+--
+-- It should update 0 rows
+--
+update id set name = 'b' where id = 0;
+select * from id;
+drop table id;
+
+--
+-- Test GENERATED ALWAYS AS IDENTITY with modified sequence
+--
+
+create table id (id serial generated always as identity(start 3) primary key, name text);
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+insert into id (id, name) values (0, 'a');
+insert into id (id, name) values (0, 'a');
+select * from id;
+--
+-- It should update 0 rows
+--
+update id set name = 'b' where id = 0;
+select * from id;
+drop table id;
+
+--
+-- Test GENERATED BY DEFAULT AS (expr)
+-- It must give a syntax error but drop it anyway.
+--
+
+create table id (id integer generated by default as (1), name text);
+drop table id;
+
+--
+-- Test GENERATED ALWAYS AS ( expr )
+--
+
+create table id (id integer generated always as (1), name text);
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+select * from id;
+--
+-- It should update 0 rows
+--
+update id set name = 'b' where id = 0;
+select * from id;
+drop table id;
+
+--
+-- Test IDENTITY with non-integer columns
+--
+
+create table id (id decimal(10,2) generated always as identity(start 3), name text);
+insert into id (id, name) values (default, 'a');
+insert into id (id, name) values (0, 'a');
+select * from id;
+alter table id alter id type real;
+insert into id (id, name) values (0, 'a');
+select * from id;
+alter table id alter id type integer;
+insert into id (id, name) values (0, 'a');
+select * from id;
+--
+-- It should update 0 rows
+--
+update id set name = 'b' where id = 0;
+select * from id;
+update id set name = 'b' where id = 5;
+select * from id;
+drop table id;
