Re: checking if sequence exists

From: Thara Vadakkeveedu <tharagv(at)yahoo(dot)com>
To: Thara Vadakkeveedu <tharagv(at)yahoo(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: checking if sequence exists
Date: 2013-11-15 19:36:03
Message-ID: 1384544163.79352.YahooMailNeo@web125002.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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(at)yahoo(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Elliot 2013-11-15 19:36:31 Re: checking if sequence exists
Previous Message Thara Vadakkeveedu 2013-11-15 19:30:40 Re: checking if sequence exists