Re: SQL: how to find if a table exists?

From: "Mario Weilguni" <mweilguni(at)sime(dot)com>
To: "Jean-Christian Imbeault" <totsubo2001(at)netscape(dot)net>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: SQL: how to find if a table exists?
Date: 2002-09-09 14:49:55
Message-ID: 005701c25810$29e0e200$6f01c00a@icomedias.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Is there an SQL statement that will allow me to query a DB to see if a
> table exists?

yes, try:
select 1 from pg_class where relkind='r' and
relname='the-name-of-your-table';

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2002-09-09 14:50:13 Re: Is there a way to query whether a table has been changed or not?
Previous Message Jan Ploski 2002-09-09 14:48:46 Re: this is postgresql question..how do i drop unique constraint on a column?