From: | Noah Misch <noah(at)leadboat(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, majid(at)apsalar(dot)com, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: [BUGS] Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns |
Date: | 2014-08-28 01:40:30 |
Message-ID: | 20140828014030.GA777962@tornado.leadboat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
On Wed, Aug 27, 2014 at 11:24:53AM -0400, Tom Lane wrote:
> On Wed, Aug 27, 2014 at 10:40:53AM -0400, Bruce Momjian wrote:
> > I looked at this issue from March and I think we need to do something.
> > In summary, the problem is that tables using inheritance can be dumped
> > and reloaded with columns in a different order from the original
> > cluster.
>
> Yeah ... this has been a well-understood issue for a dozen years, and
> pg_dump goes to considerable trouble to get it right.
pg_dump goes to trouble to preserve attislocal but not to preserve inherited
column order. Hence this thread about pg_dump getting column order wrong.
> > I think we have several options:
> >
> > 1. document this behavior
>
> That one.
+1; certainly reasonable as a first step.
> > 2. have ALTER TABLE INHERIT issue a warning about future reordering
That warning would summarize as "WARNING: this object is now subject to a
known bug". -0; I'm not strongly opposed, but it's not our norm.
> > 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.
> > My crude approach for #3 would be for pg_dump to loop over the columns
> > and, where pg_attribute.attinhcount == 0, check to see if there is a
> > matching column name in any inherited table.
That doesn't look right. attinhcount is essentially a cache; it shall equal
the number of parents having a matching column. The approach we use in binary
upgrade mode ought to suffice.
> > Will such tables load fine
> > because pg_dump binary-upgrade mode doesn't do any data loading?
We're now talking about changes to pg_dump's normal (non-binary-upgrade) mode,
right? pg_dump always gives COPY a column list, so I don't expect trouble on
the data load side of things.
Thanks,
nm
From | Date | Subject | |
---|---|---|---|
Next Message | digoal | 2014-08-28 08:39:29 | BUG #11283: PostgreSQL bug? function's variable type cached not flushed within session when the type altered. |
Previous Message | Tom Lane | 2014-08-27 23:28:45 | Re: Error with citext extension when upgrading from 9.0.3 to 9.3.5: 'cannot cast type oid[] to oidvector' |
From | Date | Subject | |
---|---|---|---|
Next Message | Tatsuo Ishii | 2014-08-28 02:08:24 | Btree internal node data? |
Previous Message | Robert Haas | 2014-08-28 01:20:10 | Re: re-reading SSL certificates during server reload |