I'm a novice to PL/pgSQL, and I'm curious, how to write function, that wraps SELECT results into INSERT script.
The functionality I need is about to replicate table data into remote DB.
I have tried dblink_build_insert(), but it requires primary key on tuple to create INSERT script from. I would prefer
filterclause to primary key, to generate either multiple inserts or one multi-row insert.
Could someone post an example how to LOOP through row fields to wrap them into 'VALUES(...,,)' list?
Thanks,
Olksy