On Tue, 19 Jun 2001, Mikael Kjellström wrote: > > 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? You'll want to use something like: declare foo name; begin ... select relname INTO foo from pg_class where relname=''tablename''; ... end; ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]