Hi, On 10 October 2011 21:35, József Kurucz <jozsef.kurucz@xxxxxxxxxx> wrote: > ERROR: syntax error at or near "$1" > LINE 1: create table $1 ( ) > ^ > QUERY: create table $1 ( ) > CONTEXT: SQL statement in PL/PgSQL function "check_table" near line 22 I think you have to use "execute": execute 'create table ' || tblname || ' ()'; http://www.postgresql.org/docs/current/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN -- Ondrej Ivanic (ondrej.ivanic@xxxxxxxxx) -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general