Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XOa1n-0006Fb-MH for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Sep 2014 22:24:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XOa1m-00046g-GZ for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Sep 2014 22:24:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XOa1k-00046Q-BU for pgsql-hackers@postgresql.org; Mon, 01 Sep 2014 22:24:44 +0000 Received: from mail-pd0-f177.google.com ([209.85.192.177]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XOa1g-0005ye-EG for pgsql-hackers@postgresql.org; Mon, 01 Sep 2014 22:24:43 +0000 Received: by mail-pd0-f177.google.com with SMTP id r10so6944149pdi.8 for ; Mon, 01 Sep 2014 15:24:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=DlwxKdUjTVDAwlHbRmUt0W3tzun1d6GdqwrLv7f0rvM=; b=PgZPwg6XbDxPJBRO/l73sZ2yBgwgaP28A/pCgczAEYgqe2HoqHnpWq+68wIDf5MRj2 d4LXTTaILAonhODY9kZymp5WBmX604YwneXcBzLXrerMZ9bskcybmTtnkpTwRSQd8Tjp dF/i12NvzyfPCGDMOKPRGI/+ouYoWdzyJlBH0PKNhPL4CIJfk/t+PPi+ALll1yHaf2Wt K5fhiMbxgl630+rFawjuln5WXiCz5DrOiOklFPve8llFtl6r8lF2xcLCgHS2eCVguHe7 iUDVNWlzQXpHdC1HwX8QYdAG8dQgNaAkU7PUa1RtdH0QA8Hxxkc23jPJBEmrt/dJEoDR UYjQ== X-Gm-Message-State: ALoCoQm50yKbpx3mqF+y74rFFpFa4EH5M9snSfb+YG+n0HrHARj/2WpWELNB/zOe+cfLLMART7o7 X-Received: by 10.70.6.97 with SMTP id z1mr42174406pdz.120.1409610277205; Mon, 01 Sep 2014 15:24:37 -0700 (PDT) Received: from tornado.leadboat.com (c-174-62-109-97.hsd1.ca.comcast.net. [174.62.109.97]) by mx.google.com with ESMTPSA id zs5sm1898611pbb.83.2014.09.01.15.24.35 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Sep 2014 15:24:36 -0700 (PDT) Date: Mon, 1 Sep 2014 18:24:34 -0400 From: Noah Misch To: Bruce Momjian Cc: Tom Lane , Alvaro Herrera , majid@apsalar.com, PostgreSQL-development Subject: Re: [BUGS] Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns Message-ID: <20140901222434.GA906981@tornado.leadboat.com> References: <20140313043900.398.17129@wrigleys.postgresql.org> <20140313134739.GD4744@eldon.alvh.no-ip.org> <15349.1394720340@sss.pgh.pa.us> <20140314153304.GA6899@eldon.alvh.no-ip.org> <20140317231212.GA3854149@tornado.leadboat.com> <20140827144053.GL14956@momjian.us> <31422.1409153093@sss.pgh.pa.us> <20140828014030.GA777962@tornado.leadboat.com> <20140830233226.GC15078@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140830233226.GC15078@momjian.us> User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -3.4 (---) 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 On Sat, Aug 30, 2014 at 07:32:26PM -0400, Bruce Momjian wrote: > On Wed, Aug 27, 2014 at 09:40:30PM -0400, Noah Misch wrote: > > > > 3. use the pg_dump binary-upgrade code when such cases happen > > > > +1. We have the convention that, while --binary-upgrade can inject catalog > > hacks, regular pg_dump uses standard, documented DDL. I like that convention > > on general aesthetic grounds and for its benefit to non-superusers. Let's > > introduce the DDL needed to fix this bug while preserving that convention, > > namely DDL to toggle attislocal. > > I have spend some time researching this, and I am not sure what to > recommend. The basic issue is that CREATE TABLE INHERITS always puts > the inherited columns first, so to preserve column ordering, you have to > use CREATE TABLE and then ALTER TABLE INHERIT. The problem there is > that ALTER TABLE INHERIT doesn't preserve attislocal, and it also has > problems with constraints not being marked local. I am just not sure we > want to add SQL-level code to do that. Would it be documented? Yes; I value the fact that ordinary pg_dump emits only documented SQL. In a similar vein, we added ALTER TABLE OF for the benefit of pg_dump. > I have developed the attached patch to warn about column reordering in > this odd case. The patch mentions the reordering of c: This, as amended downthread, seems useful. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers