Re: [GENERAL] dynamic plpgsql question

2006-12-14 Thread Alban Hertroys
Marc Evans wrote: >>> How can I get the value of NEW.{column_name} (aka NEW.magic in this >>> specific test case) into the variable data? >> EXECUTE 'SELECT ' || NEW.column_name ';' INTO data; > > Thanks for the suggestion. Unfortunately, it does not work: > > CREATE OR REPLACE FUNCTION foo() RET

Re: [GENERAL] dynamic plpgsql question

2006-12-13 Thread Erik Jones
Marc Evans wrote: On Wed, 13 Dec 2006, Erik Jones wrote: Marc Evans wrote: On Wed, 13 Dec 2006, Erik Jones wrote: Marc Evans wrote: Hi - I am struggling with a trigger function in plpgsql, and am hoping that someone on this list can't show me a way to do what I need. In the trigger, T

Re: [GENERAL] dynamic plpgsql question

2006-12-13 Thread Marc Evans
On Wed, 13 Dec 2006, Erik Jones wrote: Marc Evans wrote: On Wed, 13 Dec 2006, Erik Jones wrote: Marc Evans wrote: Hi - I am struggling with a trigger function in plpgsql, and am hoping that someone on this list can't show me a way to do what I need. In the trigger, TG_ARGV[0] is the na

Re: [GENERAL] dynamic plpgsql question

2006-12-13 Thread Tom Lane
Marc Evans <[EMAIL PROTECTED]> writes: > In the trigger, TG_ARGV[0] is the name of a column that I want to > evaluate. This is effectively impossible in plpgsql, because it's a statically typed language --- it wants to know the type of every expression in advance, and so such a thing couldn't wor

Re: [GENERAL] dynamic plpgsql question

2006-12-13 Thread Erik Jones
Marc Evans wrote: On Wed, 13 Dec 2006, Erik Jones wrote: Marc Evans wrote: Hi - I am struggling with a trigger function in plpgsql, and am hoping that someone on this list can't show me a way to do what I need. In the trigger, TG_ARGV[0] is the name of a column that I want to evaluate. T

Re: [GENERAL] dynamic plpgsql question

2006-12-13 Thread Marc Evans
On Wed, 13 Dec 2006, Erik Jones wrote: Marc Evans wrote: Hi - I am struggling with a trigger function in plpgsql, and am hoping that someone on this list can't show me a way to do what I need. In the trigger, TG_ARGV[0] is the name of a column that I want to evaluate. This code shows the

Re: [GENERAL] dynamic plpgsql question

2006-12-13 Thread Erik Jones
Marc Evans wrote: Hi - I am struggling with a trigger function in plpgsql, and am hoping that someone on this list can't show me a way to do what I need. In the trigger, TG_ARGV[0] is the name of a column that I want to evaluate. This code shows the concept, though is not functional: CREAT

[GENERAL] dynamic plpgsql question

2006-12-13 Thread Marc Evans
Hi - I am struggling with a trigger function in plpgsql, and am hoping that someone on this list can't show me a way to do what I need. In the trigger, TG_ARGV[0] is the name of a column that I want to evaluate. This code shows the concept, though is not functional: CREATE OR REPLACE FUNCTI