Hannu Krosing <[EMAIL PROTECTED]> 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-

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 anyarray
        array_pop(anyarray) returns anyelement
        array_subscript(anyarray, int) yields anyelement
        singleton_array(anyelement) yields anyarray

The last three cases cannot be handled by a SAMEASPARAM construct.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to