Re: pg_dump: use ALTER TABLE for PKs

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: Neil Conway <nconway(at)klamath(dot)dyndns(dot)org>, <pgsql-hackers(at)postgresql(dot)org>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Subject: Re: pg_dump: use ALTER TABLE for PKs
Date: 2002-02-19 22:05:56
Message-ID: 20020219135628.I90505-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Wed, 20 Feb 2002, Philip Warner wrote:

> At 13:07 19/02/02 -0800, Stephan Szabo wrote:
> >>
> >> CREATE TABLE PARENT(F1 INT PRIMARY KEY);
> >> CREATE TABLE CHILD(...) INHERIT PARENT
> >>
> >> this should create a PK on CHILD; what does pg-dump and the ALTER TABLE
> >> implementation do? Not sure how it should work, but ultimately we need to
> >
> >Unless it was changed between rc2 and release, the above type of
> >sequence does not end up with a primary key on child(f1).
>
> Interesting, - that makes pg_dumps job easier. Are any constraints ever
> inherited?

Check constraints and not null I believe are inherited by default.
But I just thought of a case that won't dump and restore the same as it
was originally made because we support ONLY on alter table add constraint.

create table z(a int);
create table z2() inherits(z);
alter table only z add constraint foo1 check(a>4);

will make z have a constraint on a but not z2 and the check will get
dumped as part of z's definition which will restore with z2 having
the check.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-02-19 22:50:37 Re: SET NULL / SET NOT NULL
Previous Message Philip Warner 2002-02-19 21:37:46 Re: pg_dump: use ALTER TABLE for PKs