Re: query for schema existence and create schema in jdbc? - Mailing list pgsql-jdbc

From Samuel Gendler
Subject Re: query for schema existence and create schema in jdbc?
Date
Msg-id AANLkTi=uAUAFg2pY6woKiCLrF24kw-FsJfCqE9kVn1QH@mail.gmail.com
Whole thread Raw
In response to query for schema existence and create schema in jdbc?  ("Hiller, Dean (Contractor)" <dean.hiller@broadridge.com>)
List pgsql-jdbc


On Fri, Jan 21, 2011 at 6:14 AM, Hiller, Dean (Contractor) <dean.hiller@broadridge.com> wrote:

I need a way(and don’t care if it is not portable) to

 

1.       Query to see if a schema exists or not

2.       Create the schema if it doesn’t exist

3.       Drop and recreate the schema if it does exist

 

ALL through JDBC.  Is this possible?



run this query, which returns a boolean:

select exists (select * from pg_catalog.pg_namespace where nspname = 'new_schema');

then either execute 'create schema new_schema;' or 'drop schema new_schema cascade; create schema new_schema;'

pgsql-jdbc by date:

Previous
From: "Hiller, Dean (Contractor)"
Date:
Subject: Re: query for schema existence and create schema in jdbc?
Next
From: rsmogura
Date:
Subject: Re: [HACKERS] Fwd: Weird issues when reading UDT from stored function