On 17 October 2011 15:20, Merlin Moncure <mmoncure@xxxxxxxxx> wrote: > A better way to do this is to query information_schema: > > PERFORM 1 FROM information_schema.tables where schema_name = x and > table_name = y; > > IF FOUND THEN > CREATE TABLE ... > END IF; > > (there is a race condition in the above code -- do you see it? if > concurrent access to this function is an issue, you have to LOCK an > object before running the PERFORM or perhaps use an advisory lock). Is there? You'd think that with transactional DDL and the code running in a single transaction (namely inside a stored function) it would be concurrency-safe. -- If you can't see the forest for the trees, Cut the trees and you'll see there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general