I said:
> ... I think it makes much more sense to push the
> complexity into the control query and keep the substitution rules
> non-surprising.
BTW, taking that approach as gospel, we could forget my idea of
declaring datatypes for the control-query results. Just substitute
'em literally. The quoting transformations could be done easily in
the control query with quote_literal() or quote_ident().
regards, tom lane