How to check if a table exists from functions. - Mailing list pgsql-sql

From mikael.kjellstrom@_no_spam_flygtaxi.se (Mikael Kjellström)
Subject How to check if a table exists from functions.
Date
Msg-id Xns90C5A38888F9Fmikaelkjellstromnosp@206.221.255.129
Whole thread Raw
Responses Re: How to check if a table exists from functions.
List pgsql-sql
Maybe I am doing this the wrong way, but how do I check if a table exist?

This works from psql:

select relname
from pg_class
where relname = 'tablename'


But if I try to do the same from a PL/PGSQL stored procedure I get the 
following error message:

ERROR:  unexpected SELECT query in exec_stmt_execsql()

Isn't select's allowed from stored procedures?

Is there a more simple way to check if a table exists?


pgsql-sql by date:

Previous
From: Adriaan Joubert
Date:
Subject: CAST issue/ecpg
Next
From: Alex Pilosov
Date:
Subject: Re: Re: binary data