Thread: Prepared Statement

Prepared Statement

From
"Rosenblum, Jason"
Date:
Is it possible to create a prepared statement with a parameter that is
actually the column name of a table?

i.e. prepare foo(?) as select $1, count(*) from boo group by $1

Thanks,
Jason

Re: Prepared Statement

From
Tom Lane
Date:
"Rosenblum, Jason" <jrosenblum@wcmh.org> writes:
> Is it possible to create a prepared statement with a parameter that is
> actually the column name of a table?

No.  In your example, how could the planner do any useful "preparation",
when it doesn't know which column to group by or even what the data type
of the grouping will be?

            regards, tom lane