Search Postgresql Archives

Re: How can I detect if a schema exists?

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

 



2013/1/10 <felix@xxxxxxxxxxx>
I was reviving an old test program which hasn't been used since 9.1 and found that "SET search_path = xyzzy" no longer fails if the schema "xyzzy" doesn't exist.

Is there an approved or recommended way to tell if a schema exists?  I can think of lots of ways, but none as easy as the 9.1 search_path.  I suppose I shouldn't rely on undocumented features ...

How about:

  SELECT TRUE FROM information_schema.schemata WHERE schema_name = 'xyzzy'

? (Though I notice this table only seems to show the schemas owned by the user if the user is not a superuser).

Ian Lawrence Barwick 

[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