Andreas Haumer <[EMAIL PROTECTED]> writes: > It seems I would have to use EXECUTE on dynamically constructed > PL/PGSQL statements in order to have my trigger function recognize > the parameters given to the trigger in TG_ARGV[]
Yup, that's exactly right. plpgsql isn't designed for this; it's designed for situations where it can pre-plan and cache plans for queries, and dynamically-inserted table and column names would just break that completely. So you have to fall back to the mechanisms for fully general constructed-on-the-fly queries, which work but are a bit painful to use. You might want to look at pltcl instead, which is much friendlier to dynamically generated queries (since that's the only way it does things). Of course, if you've never used Tcl there'll be a bit of a learning curve :-( regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match