Re: checking for existence of a table in plpgsql. - Mailing list pgsql-sql

From Bo Lorentsen
Subject Re: checking for existence of a table in plpgsql.
Date
Msg-id 1016093199.669.20.camel@netgroup
Whole thread Raw
In response to checking for existence of a table in plpgsql.  (Bhuvan A <bhuvansql@yahoo.com>)
List pgsql-sql
On Thu, 2002-03-14 at 06:40, Bhuvan A wrote:
> how can one know that a particular table exists or not in plpgsql?
How about :

SELECT INTO cnt count( * ) FROM pg_class WHERE relname='mytable';
IF FOUND THEN ...
END IF;

or 

IF cnt > 0 THEN ...
END IF;

This plpgsql snip, will find the number of classes that have the
"mytable" name.

Would this do the trick ? 

/BL



pgsql-sql by date:

Previous
From: Bo Lorentsen
Date:
Subject: Re: Large data sets and FOR LOOP's
Next
From: Jan Wieck
Date:
Subject: Re: Large data sets and FOR LOOP's