Note that parameter symbols can only be used for data values — if you
want to use dynamically determined table or column names, you must
insert them into the command string textually. For example, if the
preceding query needed to be done against a dynamically selected
table, you could do this:
EXECUTE 'SELECT count(*) FROM '
|| ' WHERE inserted_by = $1 AND inserted <= $2'
USING checked_user, checked_date;
As noted in comments below, the cast method is not always feasible, especially for CREATE statements. Consider
format function, for example:
'CREATE TABLE %I (%I %I, %I %I)',
In other words:
Yes, there is such limitation. You cannot use parameters for table/column names - that's because Postgresql needs to be able to parse query on compiling the dynamic SQL statement. Parser must be able to identify used relations.
Side note: probably this limitation applies to dynamic SQL in other DBMS, including Oracle: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/dynamic.htm#CHDHGHIF