Greg Wickham <greg@geelong.com> writes:
> 000528.19:45:45.725 [9553] query: SELECT max( $1 ) FROM $2
There is no facility in plpgsql for run-time specification of a table
name, and probably never will be for the general case. It's possible
that it could be made to work for selection of a particular table among
the inheritance children of a specified table, but not for any arbitrary
table, unless we want to give up preparsing and preplanning of plpgsql
queries.
pltcl does everything on-the-fly at runtime, so you could do this in
that language, I think (and accept the resulting speed penalty).
A more interesting question is whether you shouldn't redesign your
database schema so that you don't need to do this...
regards, tom lane