Re: [GENERAL] Dynamically update NEW columns in plpgsql trigger

2010-09-09 Thread Merlin Moncure
On Thu, Sep 9, 2010 at 6:34 PM, Nick wrote: > On Sep 9, 2:21 am, dmit...@gmail.com (Dmitriy Igrishin) wrote: >> Hey Nick, >> >> You may do it with PL/pgSQL more easily with hstore module. >> Please, refer tohttp://www.postgresql.org/docs/9.0/static/hstore.html >> Please, look at the hstore(record)

Re: [GENERAL] Dynamically update NEW columns in plpgsql trigger

2010-09-09 Thread Nick
On Sep 9, 2:21 am, dmit...@gmail.com (Dmitriy Igrishin) wrote: > Hey Nick, > > You may do it with PL/pgSQL more easily with hstore module. > Please, refer tohttp://www.postgresql.org/docs/9.0/static/hstore.html > Please, look at the hstore(record) and populate_record(record, hstore) > function. Hop

Re: [GENERAL] Dynamically update NEW columns in plpgsql trigger

2010-09-09 Thread Dmitriy Igrishin
Hey Nick, You may do it with PL/pgSQL more easily with hstore module. Please, refer to http://www.postgresql.org/docs/9.0/static/hstore.html Please, look at the hstore(record) and populate_record(record, hstore) function. Hope this helps. And I think it will be more faster then you solution. Reg

Re: [GENERAL] Dynamically update NEW columns in plpgsql trigger

2010-09-08 Thread Pavel Stehule
Hello plpgsql isn't good tool for this. use a plperl or plpython instead. your solution is extremly slow. Regards Pavel Stehule 2010/9/9 Nick : > I need to dynamically update NEW columns. Ive been inserting the NEW > values into a temp table, updating them, then passing the temp table > values

[GENERAL] Dynamically update NEW columns in plpgsql trigger

2010-09-08 Thread Nick
I need to dynamically update NEW columns. Ive been inserting the NEW values into a temp table, updating them, then passing the temp table values back to NEW (is there a better way?). Ive had success with this method unless there is a null value... EXECUTE 'CREATE TEMP TABLE new AS SELECT $1.*' USI