Re: Variable column name in plpgsql function

From: Richard Huxton <dev(at)archonet(dot)com>
To: George Woodring <george(dot)woodring(at)iglass(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Variable column name in plpgsql function
Date: 2004-12-01 17:32:38
Message-ID: 41AE0036.1060000@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message mark 2004-12-01 17:46:45 Re: Variable column name in plpgsql function
Previous Message Jan Wieck 2004-12-01 17:07:12 Re: Upcoming Changes to News Server ...