Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dGoVv-0007jM-Bk for pgsql-bugs@arkaria.postgresql.org; Fri, 02 Jun 2017 15:29:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dGoVu-0008BK-LA for pgsql-bugs@arkaria.postgresql.org; Fri, 02 Jun 2017 15:29:22 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dGoVu-0008B3-5X for pgsql-bugs@postgresql.org; Fri, 02 Jun 2017 15:29:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dGoVn-0001zp-GV for pgsql-bugs@postgresql.org; Fri, 02 Jun 2017 15:29:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v52FTC7V021639; Fri, 2 Jun 2017 11:29:12 -0400 From: Tom Lane To: buschmann@nidsa.net cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14684: pg_dump omits columns in inherited tables / psql -d shows deleted columns In-reply-to: <20170602121947.1436.81319@wrigleys.postgresql.org> References: <20170602121947.1436.81319@wrigleys.postgresql.org> Comments: In-reply-to buschmann@nidsa.net message dated "Fri, 02 Jun 2017 12:19:47 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21637.1496417352.1@sss.pgh.pa.us> Date: Fri, 02 Jun 2017 11:29:12 -0400 Message-ID: <21638.1496417352@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org buschmann@nidsa.net writes: > It seems that the catalogs are screwed up when adding /deleting columns > inderectly for inherited tables. This was tested under PG 9.6.3 and 10beta1 > under Windows x64. I could not reproduce any such misbehavior from the details you gave. Perhaps you could provide a self-contained example? (Ie, starting from scratch, create and alter some tables to arrive at a bogus state.) Note that it's not necessarily wrong for a column deleted from the parent to still exist in a child; if the child had a local definition to start with then it would still have one afterwards. For example, create table p (f1 int, f2 int, f3 int); create table c (f2 int) inherits (p); -- you'll get some bleat about merging f2 with the inherited column alter table p drop column f2; alter table p drop column f3; -- c will now have f1 (inherited) and f2 (local), but not f3 But I can't think of a case where we should allow a column to exist in a parent but not a child. You might find it useful to examine pg_attribute.attislocal (does column have a "local" definition?) and pg_attribute.attinhcount (number of times column is inherited from parent table(s)) for the seemingly-misbehaving columns. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs