Re: retrieving fields in plpgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: James Gregory <james(at)anchor(dot)net(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: retrieving fields in plpgsql
Date: 2003-03-19 05:46:21
Message-ID: 4338.1048052781@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

James Gregory <james(at)anchor(dot)net(dot)au> writes:
> I need to be able to get the value of a field in the new record provided
> to triggers. The catch is that the name of the variable that I need will
> be constructed at run time, it will then be used as part of a dynamic
> query. So basically I want
> x := "fieldname";
> y := new.x;
> Can it be done? how?

I think pltcl can do this. plpgsql is too eager to precompile things.
Of course, pltcl is a bit slower by the same token (but if you're
desperate for speed, you should be writing the trigger in C ...)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joel Rees 2003-03-19 05:54:38 access primitives in php
Previous Message Joe Conway 2003-03-19 05:24:36 Re: Limitations in PL/perl