Re: Patch to ALTER TABLE docs for 7.2.1

Lists: pgsql-hackerspgsql-patches
From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: pgsql-patches(at)postgresql(dot)org
Subject: Patch to ALTER TABLE docs for 7.2.1
Date: 2002-02-17 10:54:15
Message-ID: 20020217183321.N65686-200000@houston.familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

I think it's important that it's actually documented that they can add
primary keys after the fact!

Also, we need to add regression tests for alter table / add primary key
and alter table / drop constraint. These shouldn't be added until 7.3 tho
methinks...

Chris

Attachment Content-Type Size
pkdocs.txt text/plain 753 bytes

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch to ALTER TABLE docs for 7.2.1
Date: 2002-02-17 11:49:58
Message-ID: 200202171149.g1HBnxd08791@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


Patch applied. Thanks.

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

Christopher Kings-Lynne wrote:
> I think it's important that it's actually documented that they can add
> primary keys after the fact!
>
> Also, we need to add regression tests for alter table / add primary key
> and alter table / drop constraint. These shouldn't be added until 7.3 tho
> methinks...
>
> Chris
>

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Justin Clift <justin(at)postgresql(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch to ALTER TABLE docs for 7.2.1
Date: 2002-02-17 12:19:23
Message-ID: 3C6F9FCB.E567B111@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Awww Rats.

Wish I'd known a primary key could be added after table creation about 4
hours ago. Am wrapping up the 2nd CBT now (on Referential Integrity)
and it's a bit late for adding another section. Must read the docs more
often.

Oh well. Next CBT maybe.

:)

Regards and best wishes,

Justin Clift

Bruce Momjian wrote:
>
> Patch applied. Thanks.
>
> ---------------------------------------------------------------------------
>
> Christopher Kings-Lynne wrote:
> > I think it's important that it's actually documented that they can add
> > primary keys after the fact!
> >
> > Also, we need to add regression tests for alter table / add primary key
> > and alter table / drop constraint. These shouldn't be added until 7.3 tho
> > methinks...
> >
> > Chris
> >
>
> Content-Description:
>
> [ Attachment, skipping... ]
>
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Justin Clift" <justin(at)postgresql(dot)org>, "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Patch to ALTER TABLE docs for 7.2.1
Date: 2002-02-18 01:34:14
Message-ID: GNELIHDDFBOCMGBFGEFOMEGMCBAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Another idea. Now that we have ALTER TABLE / ADD PRIMARY KEY - we should
modify the pg_dump format to instead of doing this:

CREATE TABLE food (
a int4,
PRIMARY KEY (a)
);

COPY FROM ...

It should be like this:

CREATE TABLE food (
a int4
);

COPY FROM ...

ALTER TABLE food ADD PRIMARY KEY (a);

This will be a lot faster. The only reason (I believe) that it was not done
like this previously is that it wasn't possible to recreate a PK in any
other way without twiddling the catalogs.

Chris

> -----Original Message-----
> From: Justin Clift [mailto:justin(at)postgresql(dot)org]
> Sent: Sunday, 17 February 2002 8:19 PM
> To: Bruce Momjian
> Cc: Christopher Kings-Lynne; pgsql-patches(at)postgresql(dot)org
> Subject: Re: [PATCHES] Patch to ALTER TABLE docs for 7.2.1
>
>
> Awww Rats.
>
> Wish I'd known a primary key could be added after table creation about 4
> hours ago. Am wrapping up the 2nd CBT now (on Referential Integrity)
> and it's a bit late for adding another section. Must read the docs more
> often.
>
> Oh well. Next CBT maybe.
>
> :)
>
> Regards and best wishes,
>
> Justin Clift
>
>
> Bruce Momjian wrote:
> >
> > Patch applied. Thanks.
> >
> >
> ------------------------------------------------------------------
> ---------
> >
> > Christopher Kings-Lynne wrote:
> > > I think it's important that it's actually documented that they can add
> > > primary keys after the fact!
> > >
> > > Also, we need to add regression tests for alter table / add
> primary key
> > > and alter table / drop constraint. These shouldn't be added
> until 7.3 tho
> > > methinks...
> > >
> > > Chris
> > >
> >
> > Content-Description:
> >
> > [ Attachment, skipping... ]
> >
> > >
> > > ---------------------------(end of
> broadcast)---------------------------
> > > TIP 6: Have you searched our list archives?
> > >
> > > http://archives.postgresql.org
> >
> > --
> > Bruce Momjian | http://candle.pha.pa.us
> > pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> > + If your life is a hard drive, | 830 Blythe Avenue
> > + Christ can be your backup. | Drexel Hill,
> Pennsylvania 19026
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
> --
> "My grandfather once told me that there are two kinds of people: those
> who work and those who take the credit. He told me to try to be in the
> first group; there was less competition there."
> - Indira Gandhi
>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Justin Clift <justin(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch to ALTER TABLE docs for 7.2.1
Date: 2002-02-18 02:00:03
Message-ID: 200202180200.g1I204X02955@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

> Christopher Kings-Lynne wrote:
> Another idea. Now that we have ALTER TABLE / ADD PRIMARY KEY - we should
> modify the pg_dump format to instead of doing this:
>
> CREATE TABLE food (
> a int4,
> PRIMARY KEY (a)
> );
>
> COPY FROM ...
>
> It should be like this:
>
> CREATE TABLE food (
> a int4
> );
>
> COPY FROM ...
>
> ALTER TABLE food ADD PRIMARY KEY (a);
>
> This will be a lot faster. The only reason (I believe) that it was not done
> like this previously is that it wasn't possible to recreate a PK in any
> other way without twiddling the catalogs.

Very good point. Added to TODO:

* Have pg_dump use ADD PRIMARY KEY after COPY, for performance

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Justin Clift <justin(at)postgresql(dot)org>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, PostgreSQL Hackers Mailing List <pgsql-hackers(at)postgresql(dot)org>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: [PATCHES] Patch to ALTER TABLE docs for 7.2.1
Date: 2002-02-18 02:40:41
Message-ID: 3C7069A9.D8739ECB@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Hi Christopher,

Forwarding this to [HACKERS] as it sounds like it belong there now.

:)

This is sounds worthwhile, from the point of view that it makes it
easier for users with large data sets, and it'll assist in the
"PostgreSQL loads database dump data slowly" type problem which seems to
show itself in some people's testing.

How easy to implement this do you reckon?

:-)

Regards and best wishes,

Justin Clift

Christopher Kings-Lynne wrote:
>
> Another idea. Now that we have ALTER TABLE / ADD PRIMARY KEY - we should
> modify the pg_dump format to instead of doing this:
>
> CREATE TABLE food (
> a int4,
> PRIMARY KEY (a)
> );
>
> COPY FROM ...
>
> It should be like this:
>
> CREATE TABLE food (
> a int4
> );
>
> COPY FROM ...
>
> ALTER TABLE food ADD PRIMARY KEY (a);
>
> This will be a lot faster. The only reason (I believe) that it was not done
> like this previously is that it wasn't possible to recreate a PK in any
> other way without twiddling the catalogs.
>
> Chris
>
> > -----Original Message-----
> > From: Justin Clift [mailto:justin(at)postgresql(dot)org]
> > Sent: Sunday, 17 February 2002 8:19 PM
> > To: Bruce Momjian
> > Cc: Christopher Kings-Lynne; pgsql-patches(at)postgresql(dot)org
> > Subject: Re: [PATCHES] Patch to ALTER TABLE docs for 7.2.1
> >
> >
> > Awww Rats.
> >
> > Wish I'd known a primary key could be added after table creation about 4
> > hours ago. Am wrapping up the 2nd CBT now (on Referential Integrity)
> > and it's a bit late for adding another section. Must read the docs more
> > often.
> >
> > Oh well. Next CBT maybe.
> >
> > :)
> >
> > Regards and best wishes,
> >
> > Justin Clift
> >
> >
> > Bruce Momjian wrote:
> > >
> > > Patch applied. Thanks.
> > >
> > >
> > ------------------------------------------------------------------
> > ---------
> > >
> > > Christopher Kings-Lynne wrote:
> > > > I think it's important that it's actually documented that they can add
> > > > primary keys after the fact!
> > > >
> > > > Also, we need to add regression tests for alter table / add
> > primary key
> > > > and alter table / drop constraint. These shouldn't be added
> > until 7.3 tho
> > > > methinks...
> > > >
> > > > Chris
> > > >
> > >
> > > Content-Description:
> > >
> > > [ Attachment, skipping... ]
> > >
> > > >
> > > > ---------------------------(end of
> > broadcast)---------------------------
> > > > TIP 6: Have you searched our list archives?
> > > >
> > > > http://archives.postgresql.org
> > >
> > > --
> > > Bruce Momjian | http://candle.pha.pa.us
> > > pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> > > + If your life is a hard drive, | 830 Blythe Avenue
> > > + Christ can be your backup. | Drexel Hill,
> > Pennsylvania 19026
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
> >
> > --
> > "My grandfather once told me that there are two kinds of people: those
> > who work and those who take the credit. He told me to try to be in the
> > first group; there was less competition there."
> > - Indira Gandhi
> >

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi


From: Neil Conway <nconway(at)klamath(dot)dyndns(dot)org>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch to ALTER TABLE docs for 7.2.1
Date: 2002-02-18 03:37:46
Message-ID: 1014003466.3726.52.camel@jiro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Sun, 2002-02-17 at 21:00, Bruce Momjian wrote:
> Very good point. Added to TODO:
>
> * Have pg_dump use ADD PRIMARY KEY after COPY, for performance

I have started working on this. AFAICT, it shouldn't be too difficult
(although I haven't finished it yet, so perhaps I speak too soon ;-) ).

Cheers,

Neil

--
Neil Conway <neilconway(at)rogers(dot)com>
PGP Key ID: DB3C29FC


From: Neil Conway <nconway(at)klamath(dot)dyndns(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Patch to ALTER TABLE docs for 7.2.1
Date: 2002-02-18 03:41:19
Message-ID: 1014003679.3790.58.camel@jiro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

[re-sending to -hackers, as the thread seems to be moving there]

On Sun, 2002-02-17 at 21:00, Bruce Momjian wrote:
> Very good point. Added to TODO:
>
> * Have pg_dump use ADD PRIMARY KEY after COPY, for performance

I have started working on this. AFAICT, it shouldn't be too difficult
(although I haven't finished it yet, so perhaps I speak too soon ;-) ).

Cheers,

Neil

--
Neil Conway <neilconway(at)rogers(dot)com>
PGP Key ID: DB3C29FC


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Neil Conway" <nconway(at)klamath(dot)dyndns(dot)org>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Patch to ALTER TABLE docs for 7.2.1
Date: 2002-02-18 04:08:28
Message-ID: GNELIHDDFBOCMGBFGEFOIEGNCBAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

> > * Have pg_dump use ADD PRIMARY KEY after COPY, for performance
>
> I have started working on this. AFAICT, it shouldn't be too difficult
> (although I haven't finished it yet, so perhaps I speak too soon ;-) ).

Doh! I was just about to say that I'll do it this afternoon! I'll leave it
to you then :)

Chris