Обсуждение: postgresql ddl scripts - drop object fails entire script

Поиск
Список
Период
Сортировка

postgresql ddl scripts - drop object fails entire script

От
timasmith@hotmail.com
Дата:
On the one hand I like how the schema scripts fail when there is a
single problem with a DDL statement.

On the other hand sometimes it is a pain - especially to take out all
the 'drop sequence', 'drop table' etc commands when creating a new
database.

Is there a 'drop if doesnt exist' or a better way of doing it?

thanks


Re: postgresql ddl scripts - drop object fails entire script

От
"A. Kretschmer"
Дата:
am  Sun, dem 24.09.2006, um 18:45:12 -0700 mailte timasmith@hotmail.com folgendes:
> Is there a 'drop if doesnt exist' or a better way of doing it?

8.2, read
http://developer.postgresql.org/pgdocs/postgres/release-8-2.html

DROP object IF EXISTS


HTH, Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: postgresql ddl scripts - drop object fails entire script

От
Alban Hertroys
Дата:
timasmith@hotmail.com wrote:
> On the one hand I like how the schema scripts fail when there is a
> single problem with a DDL statement.
>
> On the other hand sometimes it is a pain - especially to take out all
> the 'drop sequence', 'drop table' etc commands when creating a new
> database.

Until 8.2 is available, maybe wrapping your DDL statements in a pl/pgsql
SP will work. pl/pgsql has exceptions...
I haven't tried this, but I expect it will work.

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
    7500 AK Enschede

// Integrate Your World //

reply-to address broken (Was: Re: postgresql ddl scripts - drop object fails entire script)

От
Alban Hertroys
Дата:
timasmith@hotmail.com wrote:
> On the one hand I like how the schema scripts fail when there is a
> single problem with a DDL statement.

Your mail address bounces. Unfortunately my Trash is broken, so I can't
show you the error; I was a bit quick deleting it.

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
    7500 AK Enschede

// Integrate Your World //