alecinvan wrote > I like to pass the tablename to function but not using execute clause, > here is my script > > [...] > > I want to pass the _tbl to the select query integrated in the unpacking(), > how can I make it? There is no way to perform a query with an unknown, at design time, identifier without using EXECUTE. The recommended way to do this is to use "format()" and dollar-quoting - v9.1+ required: v_qry := format( $qry$ WITH [...] SELECT id, func(...) FROM %I WHERE id [...] $qry$ , _tbl ); RETURN QUERY EXECUTE v_qry; David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/how-to-pass-tablename-to-a-function-tp5817864p5817871.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general