Re: PL/PGSQL: Dynamic Record Introspection - Mailing list pgsql-patches

From Tom Lane
Subject Re: PL/PGSQL: Dynamic Record Introspection
Date
Msg-id 25146.1121664758@sss.pgh.pa.us
Whole thread Raw
In response to Re: PL/PGSQL: Dynamic Record Introspection  (Neil Conway <neilc@samurai.com>)
Responses Re: PL/PGSQL: Dynamic Record Introspection
List pgsql-patches
Neil Conway <neilc@samurai.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

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Interval->day patch
Next
From: Eugen Nedelcu
Date:
Subject: Re: thousands comma numeric formatting in psql