RE: [SQL] SQL Script Question

Поиск
Список
Период
Сортировка
От Andrzej Mazurkiewicz
Тема RE: [SQL] SQL Script Question
Дата
Msg-id 13288F4408ADD11186FF0060B06A431303648C5C@MSGWAW1
обсуждение исходный текст
Список pgsql-sql
Hello.
You can utilize quick and dirty approach, i. e.
BEGIN WORK;
DROP TABLE ...
COMMIT WORK;

If table is not present it will not drop it but you will have consistent
state of transactions.

The other solution is to use pgtclsh or perl with Pg library. As far as I
know psql gives no control constructs (IF, CASE, WHILE ...).

Regards,
Andrzej Mazurkiewicz


www.mazurkiewicz.org


> -----Original Message-----
> From:    Carolyn Wong [SMTP:carolyn@kss.net.au]
> Sent:    23 lutego 2000 07:33
> To:    pgsql-sql@postgresql.org
> Subject:    [SQL] SQL Script Question
> 
> I'm trying to write SQL script to create tables as follows:
> 
> --------------------------------
> drop table xxx;
> create table xxx (
> ......
> );
> grant all on xxx to public;
> --------------------------------
> 
> Before dropping the table, I'd like to check if the table exists as the
> following psuedo code:
> 
> if <table exists>
>     drop table xxx;
> 
> How can i write this 'if' condition? Or are there any other ways to
> check this??
> 
> Thanks in advance.
> 
> ************


В списке pgsql-sql по дате отправления:

Предыдущее
От: Carolyn Wong
Дата:
Сообщение: SQL Script Question
Следующее
От: Kovacs Zoltan Sandor
Дата:
Сообщение: Re: [SQL] SQL Script Question