Hello
When I worked on parametrised DO statement, I had to solve following issue:
Syntax is:
DO (param list) $$ ... $$ LANGUAGE ... USING expr_list
What is correct way for evaluation of expr_list with specified target types?
I used two techniques:
1) evaluation expressions -
http://archives.postgresql.org/pgsql-hackers/2012-07/msg00340.php
this code is elegant and works well - with one significant issue -
doesn't support subqueries
2) SPI with parse_tree execution - SPI expect so SQL will be entered
in plain text form. But sometimes we have as input parsed tree - as
result of some parser. We can serialize tree to string, but then we
get different queryString and we will have problem with possible error
identification in queryString, I patched SPI and append a two
functions for evaluation parsed tree. Probably it should be better
done without SPI, but I missing some like DestSPI for general usage.
http://archives.postgresql.org/pgsql-hackers/2012-07/msg00361.php
What is correct way for solution of this task? I am thinking so there
some interface is missing
Regards
Pavel