Re: SQL99 ARRAY support proposal - Mailing list pgsql-hackers

From Tom Lane
Subject Re: SQL99 ARRAY support proposal
Date
Msg-id 7037.1047575566@sss.pgh.pa.us
Whole thread Raw
In response to Re: SQL99 ARRAY support proposal  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: SQL99 ARRAY support proposal  (Hannu Krosing <hannu@tm.ee>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> OK, let's look at these more closely:

>> array_push(anyarray, anyelement) returns anyarray

> The standard spelling for that appears to be
>     somearray || ARRAY[element]
> which also has the nice property that it is commutative.

Sure ... but that just means that || is the operator name for the
underlying array_push function.  We still need a way to declare this
operation as a function.


>> array_pop(anyarray) returns anyelement

> That appears to mean that you return somearray[0] and alter the array as a
> side effect.  How do you plan to do that?

Yeah, I wasn't thinking very clearly there...


>> array_subscript(anyarray, int) yields anyelement

> That's just somearray[x], no?

Yes.  But the fact that we can now represent the semantics of [] as a
function seems to me to indicate that we're on the right track in terms
of generalizing the capabilities of functions.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Zeugswetter Andreas SB SD"
Date:
Subject: Re: Roadmap for FE/BE protocol redesign
Next
From: Tom Lane
Date:
Subject: Re: Roadmap for FE/BE protocol redesign