Received: from imcwaw3.plusnet (imcwaw3.polkomtel.com.pl [212.2.96.75]) by hub.org (8.9.3/8.9.3) with ESMTP id FAA30963 for ; Wed, 23 Feb 2000 05:10:12 -0500 (EST) (envelope-from andrzej.mazurkiewicz@polkomtel.com.pl) Received: by imcwaw3.plusnet with Internet Mail Service (5.5.2448.0) id <1JFGGJZ2>; Wed, 23 Feb 2000 11:09:29 +0100 Message-ID: <13288F4408ADD11186FF0060B06A431303648C5C@MSGWAW1> From: Andrzej Mazurkiewicz To: "'Carolyn Wong'" Cc: pgsql-sql@postgresql.org Subject: RE: [SQL] SQL Script Question Date: Wed, 23 Feb 2000 11:06:13 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain 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 > drop table xxx; > > How can i write this 'if' condition? Or are there any other ways to > check this?? > > Thanks in advance. > > ************