Oh. That doesn't work for me as i generate the query dynamically and don't know their structure... Maybe there is an easy way to get the cursor structure (column - value, column - value....)? Or should i give up on cursors and try something else? Some Google search hint that hstore could be my saviour :)
maybe hstore, or json, or C extension - I wrote plpgsql toolbox https://github.com/okbob/pltoolbox . Another way is using PLPerl, PLPythonu. PLpgSQL is strongly strict language - it is not designed for dynamic tasks.
postgres=# do $$ declare r boo; -- cannot be generic record begin for r in select * from boo loop execute $_$insert into foo values($1."123")$_$ using r; end loop; end; $$; DO
Hello. Didn't find dedicated plpgsql list, so decided to post question here. I am trying to create a function that will pick up some values from cursor and execute them as a dynamic query. However, once i use EXECUTE, its seems to be ignoring the existence of cursor and try to pick up values from table. Basically: