pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_dump doesn't save altered column information for inherited columns
2+ messages / 2 participants
[nested] [flat]
* pg_dump doesn't save altered column information for inherited columns
@ 2011-02-01 09:55 depstein@alliedtesting.com
2011-02-01 16:07 ` Re: pg_dump doesn't save altered column information for inherited columns Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: depstein@alliedtesting.com @ 2011-02-01 09:55 UTC (permalink / raw)
To: pgsql-bugs; +Cc: pgagarinov@alliedtesting.com
Hello,
I noticed that when pg_dump saves SQL code for a table with inheritance, it does not save any information about inherited columns. This is fine when inherited columns do not undergo any modification, but when they do, that information is lost.
Example:
create table parent (id integer not null);
create table child (value integer) inherits (parent);
alter table child alter column id drop not null;
insert into child values (null, 1);
Here is the code of the child table as generated by pg_dump:
CREATE TABLE child (
value integer
)
INHERITS (parent);
When the table is recreated using this code, the id column has the NOT NULL restriction, which was not present in the original.
I don't think this is right. Either inherited columns should be immune to changes, or else pg_dump should reflect those changes in its SQL code.
Dmitry
Dmitry Epstein | Developer
Allied Testing
T + 7 495 544 48 69 Ext 417
M + 7 926 215 73 36
www.alliedtesting.com<http://www.alliedtesting.com/;
We Deliver Quality.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: pg_dump doesn't save altered column information for inherited columns
2011-02-01 09:55 pg_dump doesn't save altered column information for inherited columns depstein@alliedtesting.com
@ 2011-02-01 16:07 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2011-02-01 16:07 UTC (permalink / raw)
To: depstein@alliedtesting.com; +Cc: pgsql-bugs; pgagarinov@alliedtesting.com
<depstein@alliedtesting.com> writes:
> I noticed that when pg_dump saves SQL code for a table with inheritance, it does not save any information about inherited columns. This is fine when inherited columns do not undergo any modification, but when they do, that information is lost.
> Example:
> create table parent (id integer not null);
> create table child (value integer) inherits (parent);
> alter table child alter column id drop not null;
Actually, the bug here is that ALTER TABLE lets you do that. Dropping
an inherited constraint should be disallowed, and is disallowed for the
case of CHECK constraints. We haven't gotten around to enhancing the
NOT NULL infrastructure to detect that, but it's on the TODO list.
In the meantime, there's no point in modifying pg_dump to worry about
such cases.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2011-02-01 16:07 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-01 09:55 pg_dump doesn't save altered column information for inherited columns depstein@alliedtesting.com
2011-02-01 16:07 ` Tom Lane <tgl@sss.pgh.pa.us>
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