drop database if exists

Started by Andrew Dunstanover 20 years ago6 messageshackers
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

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

cheers

andrew

Attachments:

drop-db-ie.patchtext/x-patch; name=drop-db-ie.patchDownload+47-15
#2Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Andrew Dunstan (#1)
Re: [PATCHES] drop database if exists

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

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: drop database if exists

Andrew Dunstan <andrew@dunslane.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

#4Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#3)
Re: drop database if exists

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.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

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#4)
Re: drop database if exists

Andrew Dunstan <andrew@dunslane.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

#6Bruce Momjian
bruce@momjian.us
In reply to: Christopher Kings-Lynne (#2)
Re: [PATCHES] drop database if exists

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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073