19 messages in org.postgresql.pgsql-generalRe: dynamic field names in a function.
FromSent OnAttachments
Soma InterestingMar 29, 2001 2:38 pm 
Jeff EckermannMar 30, 2001 9:29 am 
Soma InterestingMar 30, 2001 10:06 am 
Soma InterestingMar 30, 2001 10:57 am 
Soma InterestingMar 30, 2001 1:58 pm 
Jeff EckermannMar 30, 2001 2:09 pm 
Soma InterestingMar 30, 2001 2:33 pm 
will trillichMar 30, 2001 3:46 pm 
Soma InterestingMar 30, 2001 4:38 pm 
will trillichMar 30, 2001 4:47 pm 
Soma InterestingMar 30, 2001 6:02 pm 
Eric G. MillerMar 30, 2001 7:29 pm 
Tom LaneMar 30, 2001 9:42 pm 
will trillichMar 30, 2001 10:04 pm 
will trillichMar 30, 2001 10:13 pm 
Tom LaneMar 31, 2001 4:57 pm 
will trillichApr 1, 2001 9:23 pm 
Tom LaneApr 1, 2001 11:27 pm 
Soma InterestingApr 3, 2001 1:23 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: dynamic field names in a function.Actions...
From:will trillich (wi@serensoft.com)
Date:Mar 30, 2001 10:04:46 pm
List:org.postgresql.pgsql-general

On Sat, Mar 31, 2001 at 12:42:29AM -0500, Tom Lane wrote:

Soma Interesting <dfu@telus.net> writes:

In the following, is there something I can do so that postgres will evaluate NEW.qty to NEW.name, treating qty as a variable and evaluating it before evaluating the field reference?

Plain PLSQL will not do this --- it wants to know field names when the query is first compiled. (This is a feature, not a bug, since it implies that the query can be optimized during compilation.)

You could use PLTCL or PLPERL instead. Both of them treat queries as plain strings that you assemble out of whatever parts you please and then pass to the query engine. Of course you pay the cost of re-planning the query from scratch every time --- there's no free lunch.

<ding ding ding> there's that magic word PLPERL again... !

HOW do you find out if your postgresql (mine's 7.0.3) can support the plperl.so feature? And HOW do you go about installing it, if it does? What parts are necessary?