Search Postgresql Archives

Re: plpgsql; execute query inside exists

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

 



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



[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