Re: Problem with function returning a result set

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Problem with function returning a result set
Дата
Msg-id 17356.1270717181@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Problem with function returning a result set  (Thomas Kellerer <spam_eater@gmx.net>)
Ответы Re: Problem with function returning a result set  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Problem with function returning a result set
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Problem with function returning a result set