Re: [GENERAL] Altering field passed as parameter to plpgsql trigger

2007-12-12 Thread Steve Crawford
Richard Huxton wrote: Steve Crawford wrote: What is the correct syntax for the line: new.field_to_alter = some_computed_value; Can't be done in plpgsql - it's too static a language. On first call, that assignments basically gets compiled into a planned query and from then on you're stuck.

Re: [GENERAL] Altering field passed as parameter to plpgsql trigger

2007-12-12 Thread Richard Huxton
Steve Crawford wrote: What is the correct syntax for the line: new.field_to_alter = some_computed_value; Can't be done in plpgsql - it's too static a language. On first call, that assignments basically gets compiled into a planned query and from then on you're stuck. You can use pl/tcl or

[GENERAL] Altering field passed as parameter to plpgsql trigger

2007-12-12 Thread Steve Crawford
I am trying to make a function that can be reused as a trigger on various tables but am somehow not finding the correct syntax for using a parameter to the function to identify the column to be altered by the trigger. Stripped to basics: create or replace function foo_trigger() returns trigger