Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XOYOh-0001ev-7H for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Sep 2014 20:40:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XOYOg-0003N9-Jt for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Sep 2014 20:40:18 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XOYOe-0003Ld-5w for pgsql-hackers@postgresql.org; Mon, 01 Sep 2014 20:40:16 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XOYOa-00071X-VT for pgsql-hackers@postgresql.org; Mon, 01 Sep 2014 20:40:14 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1XOYOZ-0006YM-4P; Mon, 01 Sep 2014 16:40:11 -0400 Date: Mon, 1 Sep 2014 16:40:11 -0400 From: Bruce Momjian To: Tom Lane Cc: David G Johnston , pgsql-hackers@postgresql.org Subject: Re: Re: [BUGS] Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns Message-ID: <20140901204011.GD19338@momjian.us> References: <20140827144053.GL14956@momjian.us> <31422.1409153093@sss.pgh.pa.us> <20140828014030.GA777962@tornado.leadboat.com> <20140830233226.GC15078@momjian.us> <4268.1409503835@sss.pgh.pa.us> <1409507164344-5817073.post@n5.nabble.com> <14363.1409508633@sss.pgh.pa.us> <20140901200040.GC19338@momjian.us> <16088.1409602018@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="+g7M9IMkV8truYOl" Content-Disposition: inline In-Reply-To: <16088.1409602018@sss.pgh.pa.us> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -3.6 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --+g7M9IMkV8truYOl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Sep 1, 2014 at 04:06:58PM -0400, Tom Lane wrote: > Bruce Momjian writes: > > NOTICE: moving and merging column "c" with inherited definition > > DETAIL: user-specified column moved to the location of the inherited > > column > > Dept of nitpicking: errdetail messages are supposed to be complete > sentences, properly capitalized and punctuated. Please re-read the > style guidelines if you have forgotten them. Oh, yeah; updated patch attached. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + --+g7M9IMkV8truYOl Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="inh-warning.diff" diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c new file mode 100644 index 3720a0f..ece6b0f *** a/src/backend/commands/tablecmds.c --- b/src/backend/commands/tablecmds.c *************** MergeAttributes(List *schema, List *supe *** 1756,1767 **** --- 1756,1771 ---- */ if (inhSchema != NIL) { + int schema_attno = 0; + foreach(entry, schema) { ColumnDef *newdef = lfirst(entry); char *attributeName = newdef->colname; int exist_attno; + schema_attno++; + /* * Does it conflict with some previously inherited column? */ *************** MergeAttributes(List *schema, List *supe *** 1780,1788 **** * Yes, try to merge the two column definitions. They must * have the same type, typmod, and collation. */ ! ereport(NOTICE, ! (errmsg("merging column \"%s\" with inherited definition", ! attributeName))); def = (ColumnDef *) list_nth(inhSchema, exist_attno - 1); typenameTypeIdAndMod(NULL, def->typeName, &defTypeId, &deftypmod); typenameTypeIdAndMod(NULL, newdef->typeName, &newTypeId, &newtypmod); --- 1784,1797 ---- * Yes, try to merge the two column definitions. They must * have the same type, typmod, and collation. */ ! if (exist_attno == schema_attno) ! ereport(NOTICE, ! (errmsg("merging column \"%s\" with inherited definition", ! attributeName))); ! else ! ereport(NOTICE, ! (errmsg("moving and merging column \"%s\" with inherited definition", attributeName), ! errdetail("User-specified column moved to the location of the inherited column."))); def = (ColumnDef *) list_nth(inhSchema, exist_attno - 1); typenameTypeIdAndMod(NULL, def->typeName, &defTypeId, &deftypmod); typenameTypeIdAndMod(NULL, newdef->typeName, &newTypeId, &newtypmod); --+g7M9IMkV8truYOl Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --+g7M9IMkV8truYOl--