Обсуждение: What is best way to query presence of a table
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
> Subject: What is best way to query presence of a table > From: Medi Montaseri <medi.montaseri@intransa.com> > Date: Thu, 02 Jan 2003 16:45:37 -0800 > To: pgsql-general <pgsql-general@postgresql.org> > > What is the best way to query presence of a table > I'd like to solve this such that I'm protected from internal changes > within PG. You might want to grab the INFORMATION_SCHEMA patch from the current source (src/backend/catalog) and apply that (after removing the check constraint on the domain, I think it is not implemented in 7.3). That would give you a method that should be safe for the future and portable to other databases. Jochem