Using %TYPE in function defs - Mailing list pgsql-general

From Dennis Gearon
Subject Using %TYPE in function defs
Date
Msg-id 21ZY7604C0OMMK21X32SOGFNM760421.3e5eb14b@cal-lab
Whole thread Raw
List pgsql-general
Answered my own question by TRYING it .... oooooo .... scary for a responsible 44 year old, who
knows the cost of experiments gone wrong. But OTOM, my instllation is just starting so I could
break something and not cry about it.

It is possible to define a function using %TYPE. Maybe this could be put in the manuals?
------------------------------------------------------------
CREATE OR REPLACE FUNCTION add_usr ( Usrs.first_name%TYPE,
                                     Usrs.middle_name%TYPE,
                                     Usrs.sur_name%TYPE,
                                     Usrs.sur_name_extra%TYPE,
                                     Gens.gen%TYPE,
                                     EmailAddrs.email_addr%TYPE,
                                     UsrEmailAddrTypes.usr_email_addr_type%TYPE,
                     UsrEmailAddrs.pri_for_usr%TYPE)
RETURNS BOOLEAN AS '
    DECLARE
    var_first_name          ALIAS FOR $1;
    var_middle_name         ALIAS FOR $2;
    var_sur_name            ALIAS FOR $3;
    var_sur_name_extra      ALIAS FOR $4;
    var_gen                 ALIAS FOR $5;
    var_email_addr          ALIAS FOR $6;
    var_usr_email_addr_type ALIAS FOR $7;
    BEGIN
        RETURN ''f'';
    END;
' LANGUAGE 'plpgsql';






pgsql-general by date:

Previous
From: "John Gray"
Date:
Subject: Re: XML in PostgreSQL
Next
From: "Ed L."
Date:
Subject: Re: 7.4?