Re: [HACKERS] pg_dump and inherited attributes

Lists: Postg사설 토토 사이트SQLPostg무지개 토토SQL
From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_dump and inherited attributes
Date: 2002-09-24 22:01:57
Message-ID: Pine.LNX.4.44.0209241757150.15113-100000@David
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Hi,

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.

What do people think about this?

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Siempre hay que alimentar a los dioses, aunque la tierra este seca" (Orual)


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)atentus(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump and inherited attributes
Date: 2002-09-25 04:01:24
Message-ID: 27371.1032926484@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

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?

regards, tom lane


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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers Postg토토 핫SQL :

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 Content-Type Size
pg_dump-attislocal.patch application/octet-stream 6.8 KB

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)atentus(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] pg_dump and inherited attributes
Date: 2002-10-04 01:17:02
Message-ID: 200210040117.g941H2e19517@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg사설 토토 사이트SQL Postg무지개 토토SQL


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Alvaro Herrera wrote:
> 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, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)atentus(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] pg_dump and inherited attributes
Date: 2002-10-09 16:20:02
Message-ID: 200210091620.g99GK2h15188@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Patch applied. Thanks.

---------------------------------------------------------------------------

Alvaro Herrera wrote:
> 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, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073