Re: Variable column name in plpgsql function - Mailing list pgsql-general

From Richard Huxton
Subject Re: Variable column name in plpgsql function
Date
Msg-id 41AE0036.1060000@archonet.com
Whole thread Raw
In response to Variable column name in plpgsql function  ("George Woodring" <george.woodring@iglass.net>)
Responses Re: Variable column name in plpgsql function  (mark <postgres@markreid.org>)
List 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

pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Upcoming Changes to News Server ...
Next
From: mark
Date:
Subject: Re: Variable column name in plpgsql function