Hi there, I would like to use EXISTS in a small plpgsql function but I always get a "syntax error". How can I execute a query inside the EXISTS function? IF NOT EXISTS(EXECUTE 'SELECT * FROM '|| tmp_tbl) THEN CREATE TABLE tt(); ERROR: syntax error at or near "EXECUTE" LINE 1: SELECT NOT EXISTS(EXECUTE 'SELECT * FROM '|| $1 ) Sorry for my lame question but I'm new in postgres. Thanks! -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general