From: Thara Vadakkeveedu <tharagv@yahoo.com>
To: Thara Vadakkeveedu <tharagv@yahoo.com>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: checking if sequence exists
Date: Fri, 15 Nov 2013 11:36:03 -0800 (PST)
Message-ID: <1384544163.79352.YahooMailNeo@web125002.mail.ne1.yahoo.com> (raw)
In-Reply-To: <1384543840.72953.YahooMailNeo@web125002.mail.ne1.yahoo.com>
References: <CA+yMuNq+unyKgCrpfmmb2WK0=toMzqrx7491n=upM8Rrj3KtwQ@mail.gmail.com>
<CAKoxK+5DvJYF3tor6=kJKdfhpxoui6PAFjuhy9WzHjZbngGDPQ@mail.gmail.com>
<CA+yMuNqxZu+xZeGiD-fdC+QZK-x9+zg03X8xzDpBvQcVTncYxg@mail.gmail.com>
<1384543840.72953.YahooMailNeo@web125002.mail.ne1.yahoo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>
I tried this from pg_admin, but I get a syntax error (unexpected character)
IF EXISTS (SELECT 0 FROM pg_class
WHERE relkind = 'S'
AND oid::regclass::text = 'public.' || quote_ident('hibernate_sequence'))
THEN
RAISE EXCEPTION 'sequence public.% already exists!', 'hibernate_sequence
ENF IF;
Thanks.
From: Thara Vadakkeveedu <tharagv@yahoo.com>
To: "pgsql-admin@postgresql.org" <pgsql-admin@postgresql.org>
Sent: Friday, November 15, 2013 2:30 PM
Subject: Re: [ADMIN] checking if sequence exists
How can we find out if a particular sequence exists ? The idea is to check if sequence first and if it does not exist then create it...the goal is to do this when we deploy the application war...
thanks
tg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tharagv@yahoo.com
Subject: Re: checking if sequence exists
In-Reply-To: <1384544163.79352.YahooMailNeo@web125002.mail.ne1.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox