Re: SQL99 ARRAY support proposal

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Joe Conway <mail(at)joeconway(dot)com>, Hannu Krosing <hannu(at)tm(dot)ee>, "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SQL99 ARRAY support proposal
Date: 2003-03-13 17:12:46
Message-ID: 7037.1047575566@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-03-13 17:32:27 Re: Roadmap for FE/BE protocol redesign
Previous Message Zeugswetter Andreas SB SD 2003-03-13 17:07:27 Re: Roadmap for FE/BE protocol redesign

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2003-03-13 17:53:15 Re: SQL99 ARRAY support proposal
Previous Message Peter Eisentraut 2003-03-13 16:50:32 Re: SQL99 ARRAY support proposal