Need a script that bakes INSERT script from SELECT results - Mailing list pgsql-sql

From ShuA
Subject Need a script that bakes INSERT script from SELECT results
Date
Msg-id E1LuPmk-0008aN-00.noface-inbox-ru@f4.mail.ru
Whole thread Raw
Responses Re: Need a script that bakes INSERT script from SELECT results
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Mario Splivalo
Date:
Subject: Re: Ordering a name list and ignoring whitespace
Next
From: John DeSoi
Date:
Subject: Re: Need a script that bakes INSERT script from SELECT results