Re: Does this table exist?
Warren Vanichuk <pyber@street-light.com>
From: Warren Vanichuk <pyber@street-light.com>
To: Alvaro Herrera <alvherre@protecne.cl>
Cc: pgsql-general@postgresql.org
Date: 2000-11-02T21:09:07Z
Lists: pgsql-general
> Now, the question is: Is there a way to know if a given table exist? > Besides doing a direct query to it, of course, as I think that would be > too much of a dinamite-fishing way of doing it. I believe you want the pg_tables table (view?) A quick and dirty way would be : select tablename from pg_tables where tablename = 'tablecheck' and if you get a row, the table exists. Alternatively you could select tablename from pg_tables where tableowner != 'postgres' and get a list of all tables in the current database that don't belong to the postgresql system. Though I'm also fairly new to PostgreSQL, so this could also be 'dynamite fishing' ;) Sincerely, Warren ----- Warren Vanichuk, Systems Engineer, Street Light Productions Ltd.