Re: PL/PGSQL: Dynamic Record Introspection

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Titus von Boxberg <ut(at)bhi-hamburg(dot)de>, pgsql-patches(at)postgresql(dot)org
Subject: Re: PL/PGSQL: Dynamic Record Introspection
Date: 2005-07-18 05:32:38
Message-ID: 25146.1121664758@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Neil Conway <neilc(at)samurai(dot)com> writes:
> Titus von Boxberg wrote:
>> What do you mean by "right syntax". There are hundreds of examples
>> in programming languages where a "small" syntactic difference leads to
>> totally different semantics.

> Well, I'm just not happy that "foo.bar" means something completely
> different than "foo%bar" -- foo%bar isn't even fetching something called
> "bar" from "foo".

There's a worse objection, which is that % is a perfectly valid operator
name (typically defined as modulo). The patch is therefore usurping
syntax of an existing feature, which is surely Right Out.

Another small problem with the patch is the untenable assumption that
neither FIELDNAMES nor NFIELDS is ever used by anyone as an actual field
name.

Assuming that we're inventing in a green field, I'd suggest a syntax
along this line:

recordvalue.(stringexpression)

which is not confusable with any currently-valid syntax. I'm not sure
what to do about FIELDNAMES --- perhaps this would work:

recordvalue.(*)

As for NFIELDS, I don't think we need it -- you can always measure the
length of the FIELDNAMES array.

But the real $64 question for plpgsql stuff is "what does Oracle do?"
Is there any remotely comparable functionality in PL/SQL, and if so
what does it look like?

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Eugen Nedelcu 2005-07-18 08:14:59 Re: thousands comma numeric formatting in psql
Previous Message Tom Lane 2005-07-17 04:43:15 Re: Autovacuum loose ends