On Jul 19, 2010, at 10:43 AM, Jennifer Trey wrote: > No.... I don't want to drop it ... there is valuable data in there! I only want to create it if it doesn't already exist... likely going to happen first time the application will run. I want to create the table then and populate. But not the next time. > > Should I just let Java throw and exception and catch it ? Write a function for this would be optimal, although I have no idea what the correct syntax is. > > Cheers, Jen Try something like this: create or replace function build_foo_table() returns void as $$ create table foo (bar int); $$ language sql; select case when (select count(*) from information_schema.tables where table_name='foo')=0 then build_foo_table() end; drop function build_foo_table(); Cheers, Steve -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general