pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
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
Date: Fri, 02 Jun 2017 11:29:12 -0400
Message-ID: <21638.1496417352@sss.pgh.pa.us> (raw)
In-Reply-To: <20170602121947.1436.81319@wrigleys.postgresql.org>
References: <20170602121947.1436.81319@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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



view thread (4+ messages)  latest in thread

Message-ID: <21638.1496417352@sss.pgh.pa.us>
Permalink:  ../21638.1496417352@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21638.1496417352@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, buschmann@nidsa.net
  Subject: Re: BUG #14684: pg_dump omits columns in inherited tables / psql -d shows deleted columns
  In-Reply-To: <21638.1496417352@sss.pgh.pa.us>
  References: <20170602121947.1436.81319@wrigleys.postgresql.org> <21638.1496417352@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox