[Go-essp-tech] Idempotent SQL?
Wang, Feiyi
fwang2 at ornl.gov
Fri Feb 4 11:11:59 MST 2011
For postgres, I think you can do:
if table exists, drop the table first
otherwise create.
Feiyi
On Feb 4, 2011, at 12:53 PM, Gavin M. Bell wrote:
Hi,
:-(
I tried that... it doesn't work for postgres :-|.
I am trying to find the analogous command for postgres.
(maybe we should just use H2...) ;-).
On 2/4/11 9:50 AM, Cinquini, Luca (3880) wrote:
Hi Gavin,
this kind of statements worked for Java H2DB - not sure about postgres...
-- WORKFLOW INSTANCE TYPE
CREATE TABLE IF NOT EXISTS WORKFLOW_INSTANCE_TYPE (
TYPE INT PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(200) NOT NULL
);
MERGE INTO WORKFLOW_INSTANCE_TYPE (TYPE, DESCRIPTION ) VALUES (1, 'DESDynI Standard');
Luca
On Feb 4, 2011, at 10:45 AM, Gavin M. Bell wrote:
Hey SQL Mavens...
Does anyone know how to create idempotent SQL scripts?
If something is there already, then don't create it...
If it is not, then do so.
(the pithier the better)
Thanks
--
Gavin M. Bell
Lawrence Livermore National Labs
--
"Never mistake a clear view for a short distance."
-Paul Saffo
(GPG Key - http://rainbow.llnl.gov/dist/keys/gavin.asc)
A796 CE39 9C31 68A4 52A7 1F6B 66B7 B250 21D5 6D3E
_______________________________________________
GO-ESSP-TECH mailing list
GO-ESSP-TECH at ucar.edu<mailto:GO-ESSP-TECH at ucar.edu>
http://mailman.ucar.edu/mailman/listinfo/go-essp-tech
--
Gavin M. Bell
Lawrence Livermore National Labs
--
"Never mistake a clear view for a short distance."
-Paul Saffo
(GPG Key - http://rainbow.llnl.gov/dist/keys/gavin.asc)
A796 CE39 9C31 68A4 52A7 1F6B 66B7 B250 21D5 6D3E
_______________________________________________
GO-ESSP-TECH mailing list
GO-ESSP-TECH at ucar.edu<mailto:GO-ESSP-TECH at ucar.edu>
http://mailman.ucar.edu/mailman/listinfo/go-essp-tech
More information about the GO-ESSP-TECH
mailing list