Found small issue with OUT params - Mailing list pgsql-hackers

From Tony Caduto
Subject Found small issue with OUT params
Date
Msg-id 433AEAA7.1060004@amsoftwaredesign.com
Whole thread Raw
Responses Re: Found small issue with OUT params
List pgsql-hackers
Hi,
consider this function:      
CREATE OR REPLACE FUNCTION FIND_USER_SOCKET_BYNAME (   IN IN_USERNAME VARCHAR,   OUT OUT_SOCKET_ADDRESS INTEGER)
AS
$BODY$
BEGIN    select socket_address from userdata where fullname = in_username into    out_socket_address;
     if out_socket_address is null then       out_socket_address = 0 ;     end if;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE

If I call it like this:
select * from FIND_USER_SOCKET_BYNAME('juser');

I would expect to get back 1 value with the name of the OUT param 
(OUT_SOCKET_ADDRESS). 
However it comes back with the name of the function which I would expect 
if I called it like this:

select FIND_USER_SOCKET_BYNAME('juser');

If I add another OUT value then the value comes back with the name of 
the out param(plus the temp one I added) as expected.

It's easy enough to work around, but was not as expected.

Thanks,

Tony Caduto




pgsql-hackers by date:

Previous
From: "Ilia Kantor"
Date:
Subject: Re: effective SELECT from child tables
Next
From: Tom Lane
Date:
Subject: Re: Found small issue with OUT params