Re: [GENERAL] Variable column name in plpgsql function

2004-12-01 Thread mark
Richard Huxton wrote: George Woodring wrote: Is possible to declare a variable to build the column name Tableid varchar(20) := TG_RELNAME || ''id''; And then use this variable to get the PK value? Tableidvalue int4 := NEW.tableid; No. You can build a dynamic query via EXECUTE, but that can't acces

Re: [GENERAL] Variable column name in plpgsql function

2004-12-01 Thread Richard Huxton
George Woodring wrote: Is possible to declare a variable to build the column name Tableid varchar(20) := TG_RELNAME || ''id''; And then use this variable to get the PK value? Tableidvalue int4 := NEW.tableid; No. You can build a dynamic query via EXECUTE, but that can't access NEW/OLD. -- Richa

[GENERAL] Variable column name in plpgsql function

2004-12-01 Thread George Woodring
I am trying to create a trigger that needs to capture the primary key value out of NEW variable. However the trigger can be called from 2 different tables whose PKs are Table1id Table2id Is possible to declare a variable to build the column name Tableid varchar(20) := TG_RELNAME || ''id''; And