Simon Riggs <simon@2ndquadrant.com> writes:
> It sounds like you don't know about anonymous code blocks with DO
> https://www.postgresql.org/docs/devel/static/sql-do.html
No, the problem was that there are also some parameters to be passed
in from the application, and DO doesn't take any parameters; so that
would require inserting them manually into the DO text, with all the
attendant hazards of getting-it-wrong.
We've speculated before about letting DO grow some parameter handling,
but it's not gotten to the top of anyone's to-do list.
regards, tom lane