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