Re: drop database if exists

Lists: pgsql-hackerspgsql-patches
From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: drop database if exists
Date: 2005-11-21 14:20:36
Message-ID: 4381D7B4.60908@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

here's a patch for "drop database if exists". Barring objections I will
apply it in a day or two.

cheers

andrew

Attachment Content-Type Size
drop-db-ie.patch text/x-patch 6.2 KB

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] drop database if exists
Date: 2005-11-21 14:27:42
Message-ID: 4381D95E.6020607@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


> here's a patch for "drop database if exists". Barring objections I will
> apply it in a day or two.

Should we use the IF EXISTS syntax in pg_dump output? For all DROP
commands in clean mode?

Might make it easier to wrap pg_dump output in a transaction?

Chris


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: drop database if exists
Date: 2005-11-21 15:18:17
Message-ID: 1853.1132586297@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> here's a patch for "drop database if exists". Barring objections I will
> apply it in a day or two.

Please try to remember the src/backend/nodes/ files this time.

(In general, when modifying a widely-known struct such as a parse node
type, it's a good idea to grep for every single mention of the struct
type to make sure you've not missed anything.)

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: drop database if exists
Date: 2005-11-21 15:49:47
Message-ID: 4381EC9B.3010209@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:

>Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>
>>here's a patch for "drop database if exists". Barring objections I will
>>apply it in a day or two.
>>
>>
>
>Please try to remember the src/backend/nodes/ files this time.
>
>(In general, when modifying a widely-known struct such as a parse node
>type, it's a good idea to grep for every single mention of the struct
>type to make sure you've not missed anything.)
>
>
>
>

oops, ok, thanks, will do. Should we perhaps add a note to parsenodes.h ?

cheers

andrew


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: drop database if exists
Date: 2005-11-21 17:03:59
Message-ID: 2551.1132592639@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Tom Lane wrote:
>> (In general, when modifying a widely-known struct such as a parse node
>> type, it's a good idea to grep for every single mention of the struct
>> type to make sure you've not missed anything.)

> oops, ok, thanks, will do. Should we perhaps add a note to parsenodes.h ?

[ shrug... ] There are a whole lot of header files that would need such
a note, and I suspect people wouldn't read it anyway :-(

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] drop database if exists
Date: 2005-11-24 04:40:55
Message-ID: 200511240440.jAO4etS29580@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Christopher Kings-Lynne wrote:
>
> > here's a patch for "drop database if exists". Barring objections I will
> > apply it in a day or two.
>
> Should we use the IF EXISTS syntax in pg_dump output? For all DROP
> commands in clean mode?

Yes, I was thinking it should be used for pg_dump --clean, which is a
TODO item. I was also thinking the DROP OWNER could be used for
--clean:

o Allow pg_dump --clean to drop roles that own objects or have
privileges

--
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