Re: if exists?

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Vincent Stoessel <vincent(at)xaymaca(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: if exists?
Date: 2002-05-13 15:31:48
Message-ID: 1021303908.1539.55.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2002-05-13 at 14:33, Vincent Stoessel wrote:
> Is there an sql query that I can use on postgres that will tell
> me if a table exists?

SELECT relname
FROM pg_class
WHERE relname = 'your_table' AND relkind = 'r';

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C

"Watch ye and pray, lest ye enter into temptation. The
spirit truly is ready, but the flesh is weak."
Mark 14:38

In response to

  • if exists? at 2002-05-13 13:33:38 from Vincent Stoessel

Browse pgsql-general by date

  From Date Subject
Next Message Shaun Thomas 2002-05-13 15:33:35 Re: if exists?
Previous Message Lee Kindness 2002-05-13 15:26:14 if exists?