Search Postgresql Archives

Re: drop table before create

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have not been able to work out how to do this is Postgres 8
(pseudo-code)

 if exists table foo
   drop table foo;
 end
 create table foo;

If I go with

  drop table foo;
  create table foo;

then it barfs on an empty db.


The assumption here is that the SQL is coming in on a script via the
programmatic interface.  Slurp in a bunch of SQL commands and then fire
them at the database.



There are a couple of commands that may help you:

\set ON_ERROR_STOP
\unset ON_ERROR_STOP

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux