Re: [GENERAL] quick q re execute & scope of new

2015-04-03 Thread Adrian Klaver
On 04/02/2015 09:59 PM, Scott Ribe wrote: On Apr 2, 2015, at 10:14 PM, Adrian Klaver 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.* into a

Re: [GENERAL] quick q re execute & scope of new

2015-04-02 Thread Andrew J. Kopciuch
On April 2, 2015, Scott Ribe wrote: > On Apr 2, 2015, at 10:14 PM, Adrian Klaver 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.* into

Re: [GENERAL] quick q re execute & scope of new

2015-04-02 Thread Scott Ribe
On Apr 2, 2015, at 10:14 PM, Adrian Klaver 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.* into a string as needed for this use, but I foun

Re: [GENERAL] quick q re execute & scope of new

2015-04-02 Thread Scott Ribe
On Apr 2, 2015, at 10:10 PM, Tom Lane wrote: > > Not like that, for certain. It might work to use EXECUTE ... USING new.* > or some variant of that. Couldn't get a variant of that to work, but this did: execute('insert into ' || tblnm || ' select $1.*') using new; -- Scott Ribe scott_r...@el

Re: [GENERAL] quick q re execute & scope of new

2015-04-02 Thread Adrian Klaver
On 04/02/2015 08:30 PM, Scott Ribe wrote: Easier to give an example than describe the question, any chance of making something like this work? You doing this in plpgsql trigger function I presume? execute('insert into ' || tblname || ' values(new.*)'); So http://www.postgresql.org/docs/

Re: [GENERAL] quick q re execute & scope of new

2015-04-02 Thread Tom Lane
Scott Ribe writes: > Easier to give an example than describe the question, any chance of making > something like this work? > execute('insert into ' || tblname || ' values(new.*)'); Not like that, for certain. It might work to use EXECUTE ... USING new.* or some variant of that.

[GENERAL] quick q re execute & scope of new

2015-04-02 Thread Scott Ribe
Easier to give an example than describe the question, any chance of making something like this work? execute('insert into ' || tblname || ' values(new.*)'); -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ https://www.linkedin.com/in/scottribe/ (303) 722-0567 voice