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.
-- Richard Huxton Archonet Ltd
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html