Re: quick q re execute & scope of new - Mailing list pgsql-general

From Adrian Klaver
Subject Re: quick q re execute & scope of new
Date
Msg-id 551EA16A.30001@aklaver.com
Whole thread Raw
In response to Re: quick q re execute & scope of new  (Scott Ribe <scott_ribe@elevated-dev.com>)
List pgsql-general
On 04/02/2015 09:59 PM, Scott Ribe wrote:
> On Apr 2, 2015, at 10:14 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>>
>> EXECUTE 'insert into ' || quote_ident(tblname) || ' values(' || new.* || ')'
>
> Not that easy, strings are not quoted correctly, and null values are blank. Might be a function to translate new.*
intoa string as needed for this use, but I found another way based on Tom's suggestion: 

My mistake for grabbing off the top of my head without testing my code.

>
> execute('insert into ' || tblnm || ' select $1.*') using new;
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: John McKown
Date:
Subject: Re: The case of PostgreSQL on NFS Server (II)
Next
From: Filipe Pina
Date:
Subject: Serializable transaction restart/re-execute