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

From Tom Lane
Subject Re: SQL99 ARRAY support proposal
Date
Msg-id 17166.1047307787@sss.pgh.pa.us
Whole thread Raw
In response to Re: SQL99 ARRAY support proposal  (Hannu Krosing <hannu@tm.ee>)
Responses Re: SQL99 ARRAY support proposal  (Joe Conway <mail@joeconway.com>)
Re: SQL99 ARRAY support proposal  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Hannu Krosing <hannu@tm.ee> writes:
> Joe Conway kirjutas E, 10.03.2003 kell 05:35:
>> CREATE OR REPLACE FUNCTION array_push (anyarray, anyscalar)
>> RETURNS anyarray

> could you make it
> RETURNS typeof($1)

Not directly --- we have to fit the return-type info into an OID field.
We could fake it by inventing one or more pseudotypes, "SAMEASPARAMn".

But I think I like better the notion of extending my bound-together-
ANYARRAY-and-ANYELEMENT proposal,
http://archives.postgresql.org/pgsql-hackers/2003-03/msg00319.php

Suppose that we do that, and then further say that ANYARRAY or
ANYELEMENT appearing as the return type implies that the return type
is actually the common element or array type.  Then we have such
useful behaviors as:
array_push(anyarray, anyelement) returns anyarrayarray_pop(anyarray) returns anyelementarray_subscript(anyarray, int)
yieldsanyelementsingleton_array(anyelement) yields anyarray
 

The last three cases cannot be handled by a SAMEASPARAM construct.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Cursors and backwards scans and SCROLL
Next
From: Justin Clift
Date:
Subject: Re: Who puts the Windows binaries on the FTP server?