Skip site navigation (1) Skip section navigation (2)

Re: Test if a table is present

From: Volkan YAZICI <yazicivo(at)ttmail(dot)com>
To: "Ole Ekerhovd" <olehare(at)online(dot)no>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Test if a table is present
Date: 2008-07-26 05:48:11
Message-ID: 87bq0li4bo.fsf@alamut.mobiliz.com.tr (view raw or flat)
Thread:
Lists: pgsql-sql
On Sat, 26 Jul 2008, "Ole Ekerhovd" <olehare(at)online(dot)no> writes:
> How can I test if a table is present in database?

  SELECT TRUE
    FROM information_schema.tables
   WHERE table_name   = '<TABLE>' AND
         table_schema = '<SCHEMA>'

BTW, this query is portable across database systems supporting
information schema, which is an almost defacto standard.


Regards.

In response to

pgsql-sql by date

Next:From: Allan KamauDate: 2008-07-26 13:17:56
Subject: Efficiently determining the number of bits set in the contents of a VARBIT field
Previous:From: Anoop GDate: 2008-07-26 05:33:26
Subject: Re: Test if a table is present

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group