What is best way to query presence of a table - Mailing list pgsql-general

From Medi Montaseri
Subject What is best way to query presence of a table
Date
Msg-id 3E14DD31.8060706@intransa.com
Whole thread Raw
List pgsql-general
What is the best way to query presence of a table

select relname from pg_class where relname = 'SomeTable';

or

select * from SomeTable    -- I know this one succss but I don't have to
wory
about pg_* changing under me....

or

select exists('SomeTable');

Where exists() is a pg built in function -- I am wishing here for a feature

I'd like to solve this such that I'm protected from internal changes
within PG.
Obviously the suggested method above similar to version() can abstract that.

Also, when I create my table, can I say create or replace (for base
tables) ?

Thanks


pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pg_restore woes..
Next
From: Tom Lane
Date:
Subject: Re: pg_restore woes..