Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] pg_dump and inherited attributes

From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] pg_dump and inherited attributes
Date: 2002-09-28 19:44:02
Message-ID: 20020928154402.6c5e8df1.alvherre@atentus.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
En Wed, 25 Sep 2002 00:01:24 -0400
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> escribió:

> Alvaro Herrera <alvherre(at)atentus(dot)com> writes:
> > I'm looking at pg_dump/common.c:flagInhAttrs() and suspect that it can
> > be more or less rewritten completely, and probably should to get rigth
> > all the cases mentioned in the past attisinherited discussion.  Is this
> > desirable for 7.3?  It can probably be hacked around and the rewrite
> > kept for 7.4, but I think it will be much simpler after the rewrite.
> 
> If it's a bug then it's fair game to fix in 7.3.  But keep in mind that
> pg_dump has to behave at least somewhat sanely when called against older
> servers ... will your rewrite behave reasonably if the server does not
> offer attinhcount values?

Nah.  I don't think it's worth it: I had forgotten that older versions
should be supported.  I just left the code as is and added a
version-specific test.

This patch allows pg_dump to dump correctly local definition of columns.
In particular,

CREATE TABLE p1 (f1 int, f2 int);
CREATE TABLE p2 (f1 int);
CREATE TABLE c () INHERITS (p1, p2);
ALTER TABLE ONLY p1 DROP COLUMN f1;
CREATE TABLE p3 (f1 int);
CREATE TABLE c2 (f1 int) INHERITS (p3);

Will be dumped as
CREATE TABLE p1 (f2 int);
CREATE TABLE p2 (f1 int);
CREATE TABLE c (f1 int) INHERITS (p1, p2);
CREATE TABLE c2 (f1 int) INHERITS (p3);

(Previous version will dump
CREATE TABLE c () INHERITS (p1, p2)
CREATE TABLE c2 () INHERITS (p3) )

-- 
Alvaro Herrera (<alvherre[a]atentus.com>)
A male gynecologist is like an auto mechanic who never owned a car.
- Carrie Snow

Attachment: pg_dump-attislocal.patch
Description: application/octet-stream (6.8 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2002-09-28 20:14:17
Subject: Re: 7.2.3?
Previous:From: Alvaro HerreraDate: 2002-09-28 19:19:44
Subject: Re: 7.2.3?

pgsql-patches by date

Next:From: Tom LaneDate: 2002-09-28 20:38:29
Subject: Re: [PATCHES] Cascaded Column Drop
Previous:From: Neil ConwayDate: 2002-09-28 01:40:45
Subject: tweak CREATE SEQUENCE grammar

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group