From: Tom Lane Date: Wed, 11 Oct 2006 20:03:18 +0000 (+0000) Subject: CREATE TABLE ... LIKE ... should mark the columns it creates with X-Git-Tag: REL8_0_9~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8608aa953475e58899d630d1bea6beb9a3a370f4;p=thirdparty%2Fpostgresql.git CREATE TABLE ... LIKE ... should mark the columns it creates with attislocal = true, since they are not really inherited but merely copied from the original table. I'm not sure if there are any cases where it makes a real difference given the existing uses of the flag, but wrong is wrong. This was fixed in passing in HEAD by the LIKE INCLUDING CONSTRAINTS patch, but never back-patched. --- diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index e768f607985..d8487293287 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.314.4.1 2005/02/19 19:33:23 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.314.4.2 2006/10/11 20:03:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1107,7 +1107,7 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt, constr = tupleDesc->constr; /* - * Insert the inherited attributes into the cxt for the new table + * Insert the copied attributes into the cxt for the new table * definition. */ for (parent_attno = 1; parent_attno <= tupleDesc->natts; @@ -1125,7 +1125,7 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt, continue; /* - * Create a new inherited column. + * Create a new column, which is marked as NOT inherited. * * For constraints, ONLY the NOT NULL constraint is inherited by the * new column definition per SQL99. @@ -1137,7 +1137,7 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt, typename->typmod = attribute->atttypmod; def->typename = typename; def->inhcount = 0; - def->is_local = false; + def->is_local = true; def->is_not_null = attribute->attnotnull; def->raw_default = NULL; def->cooked_default = NULL;