Re: patch: plpgsql - access records with rec.(expr)

From: Neil Conway <neilc(at)samurai(dot)com>
To: Matt <matt(at)kynx(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch: plpgsql - access records with rec.(expr)
Date: 2004-11-23 00:07:13
Message-ID: 1101168433.12361.17.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2004-11-22 at 10:06 +0000, Matt wrote:
> This would execute a string and pass back the result?

It would evaluate a string as a PL/PgSQL statement (which means you
could construct any PL/PgSQL statement dynamically, including access to
fields of a RECORD determined at runtime).

> > I don't like this: it implicitly coerces a string literal into an
> > identifier (i.e. a column name). Treating data as code can be useful,
> > but I think we need to make it more obvious to the user. I think a
> > proper EVALUATE statement might be a better solution.
>
> See your point. But what about NEW.($1)?

I don't follow -- what do you mean?

(BTW, I think my comment also applies to variables of type "text" and
similar -- I think the patch would be a lot simpler if you just
implement access to record fields by ordinal position, and don't
implement access by field name.)

-Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-11-23 00:22:04 Re: another plperl bug
Previous Message Simon Riggs 2004-11-23 00:04:17 Re: [Testperf-general] Re: ExclusiveLock