Is there
an idiomatic way to approach this problem?
I would use pl/pgsql as the language and build a query using a combination of text literals and the format() function - invoking via pl/pgsql's EXECUTE command.
David J.
Is there
an idiomatic way to approach this problem?