From: | Warren Vanichuk <pyber(at)street-light(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)protecne(dot)cl> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Does this table exist? |
Date: | 2000-11-02 21:09:07 |
Message-ID: | Pine.LNX.4.21.0011021304240.15920-100000@urd.street-light.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-11-02 21:15:00 | Re: CREATE FUNCTION problem |
Previous Message | Ashley Clark | 2000-11-02 21:01:45 | Re: Does this table exist? |