Re: How can I check whether a table is existing or not

Lists: pgsql-interfaces
From: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: How can I check whether a table is existing or not
Date: 2000-12-11 10:48:30
Message-ID: 3A34B0FE.3E28674F@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

I am using Perl/DBI and I want to know whether I can check if a certain
table is in the database or not.
How can I do that without getting "ugly" messages on STDERR?

Hans


From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: Hans-Jrgen Schnig <hs(at)cybertec(dot)at>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: How can I check whether a table is existing or not
Date: 2000-12-13 17:10:19
Message-ID: m3n1e0tfgk.fsf@dep3.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Hans-Jrgen Schnig <hs(at)cybertec(dot)at> writes:

> I am using Perl/DBI and I want to know whether I can check if a certain
> table is in the database or not.
> How can I do that without getting "ugly" messages on STDERR?

You can query the system catalogs for the relation you are interested
in; The following query might help:

SELECT c.relname FROM pg_class c WHERE c.relname = 'my_table';

where my_table is the name of the table you are looking for.

Regards,
Manuel.