Re: Problem with function returning a result set - Mailing list pgsql-sql

From Thomas Kellerer
Subject Re: Problem with function returning a result set
Date
Msg-id hpk7lm$gmq$1@dough.gmane.org
Whole thread Raw
In response to Re: Problem with function returning a result set  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Tom Lane, 08.04.2010 10:59:
> Thomas Kellerer<spam_eater@gmx.net>  writes:
>> CREATE OR REPLACE FUNCTION get_employees(name_pattern varchar)
>> RETURNS TABLE(id integer, full_name text)
>> AS
>> $$
>> BEGIN
>
>>     RETURN QUERY
>>       SELECT id, first_name||' '||last_name
>>       FROM employee
>>       WHERE last_name LIKE name_pattern ||'%';
>> END
>> $$
>> LANGUAGE plpgsql;
>
>> I get one row returned which is correct, but the ID column is null
>> (but should be 1).
>
> Don't name the parameter the same as the table column ...
>
>             regards, tom lane
>
I knew it was something simple I overlooked ;)

Thanks for the quick response.

Regards
Thomas




pgsql-sql by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Problem with function returning a result set
Next
From: Rob Sargent
Date:
Subject: Re: Table Design for Hierarchical Data