Re[3]: [SQL] Need a script that bakes INSERT script from SELECT results

2009-04-23 Thread ShuA
-Original Message- From: ShuA To: John DeSoi Date: Thu, 16 Apr 2009 16:24:05 +0300 Subject: Re[2]: [SQL] Need a script that bakes INSERT script from SELECT results > > -Original Message- > From: John DeSoi > To: ShuA > Date: Thu, 16 Apr 2009 08:25:15 -0400 >

Re[2]: [SQL] Need a script that bakes INSERT script from SELECT results

2009-04-16 Thread ShuA
-Original Message- From: John DeSoi To: ShuA Date: Thu, 16 Apr 2009 08:25:15 -0400 Subject: Re: [SQL] Need a script that bakes INSERT script from SELECT results > On Apr 16, 2009, at 7:29 AM, ShuA wrote: > > > Could someone post an example how to LOOP through row fi

Re: [SQL] Need a script that bakes INSERT script from SELECT results

2009-04-16 Thread John DeSoi
On Apr 16, 2009, at 7:29 AM, ShuA wrote: Could someone post an example how to LOOP through row fields to wrap them into 'VALUES(...,,)' list? If you declare record or table row types, you can insert the values using (rec.*), something like this: create or replace function test () retur

[SQL] Need a script that bakes INSERT script from SELECT results

2009-04-16 Thread ShuA
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 wou