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

From Titus von Boxberg
Subject Re: PL/PGSQL: Dynamic Record Introspection
Date
Msg-id 42D67C8F.6060502@bhi-hamburg.de
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 schrieb:
> I wonder if this is the right syntax. record%identifier is doing
> something fundamentally different from record.identifier, but the syntax
> doesn't make that clear. I don't have any concrete suggestions for
> improvement, mind you... :)
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.
I chose % because
- it's already used in the var%TYPE notation. Here %xxx stands for
   a kind of extracting operator, too. In this sense, %TYPE's operation is similar
   to variables what %NFIELDS, %FIELDNAMES and %variable do to records.
- I could not think of any other operator that would not be harmful
   for the parser (or cause much work) and also would not lead to
   other ambiguities in the sense not being "right".
- % strongly differs optically from .

-------------------

>
> Can you supply some proper regression tests, please? i.e. patch
> sql/plpgsql.sql and expected/plpgsql.out in src/test/regress
I'll do that.
>
> A few minor comments from skimming the patch:
I'll implement your suggestions.

I'll also remove the changes to the RECFIELD value evaluation semantics
completely that I introduced.

--------------------

Are there any general objections to implement this feature?
Personally, I would very much like to see it implemented because
I do want to use plpgsql and without this feature (trigger)
procedures cannot be held general if dealing with structural
similarities between tables they are invoked upon.

I'd send the patched patch when I'm done.

Regards
Titus

pgsql-patches by date:

Previous
From: Titus von Boxberg
Date:
Subject: Re: PL/PGSQL: Dynamic Record Introspection
Next
From: Eugen Nedelcu
Date:
Subject: Re: thousands comma numeric formatting in psql