Re: RETURNS TABLE function: ERROR: column reference "word" is ambiguous

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: RETURNS TABLE function: ERROR: column reference "word" is ambiguous
Дата
Msg-id 66cd9c5e-56a7-46bd-6723-a4e81f7a7141@aklaver.com
обсуждение исходный текст
Ответ на Re: RETURNS TABLE function: ERROR: column reference "word" is ambiguous  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
On 08/10/2016 10:30 AM, David G. Johnston wrote:
> On Wed, Aug 10, 2016 at 1:19 PM, Pavel Stehule <pavel.stehule@gmail.com
> <mailto:pavel.stehule@gmail.com>>wrote:
>
>
>
>     2016-08-10 19:05 GMT+02:00 Alexander Farber
>     <alexander.farber@gmail.com <mailto:alexander.farber@gmail.com>>:
>
>         Thank you Adrian and others -
>
>         I am trying to replace INSERT into temp table in my custom
>         function by RETURN NEXT, but get an error:
>
>             CREATE OR REPLACE FUNCTION words_check_words(
>                     IN in_uid integer,
>                     IN in_gid integer,
>                     IN in_tiles jsonb)
>                     RETURNS TABLE(word varchar, score integer) AS
>             $func$
>             .......
>
>                                 -- INSERT INTO _words(word, score)
>                                 -- VALUES (upper(_word), _score);
>
>                                 RETURN NEXT (word, score);
>
>
>         ERROR:  RETURN NEXT cannot have a parameter in function with OUT
>         parameters
>         LINE 98:                         RETURN NEXT (word, score);
>
>
>     This was limit in older version
>
>
> ​He's supposedly using 9.5​ which documents "RETURN NEXT expression;"
>
> https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html

"If you declared the function with output parameters, write just RETURN
NEXT with no expression. On each execution, the current values of the
output parameter variable(s) will be saved for eventual return as a row
of the result. Note that you must declare the function as returning
SETOF record when there are multiple output parameters, or SETOF
sometype when there is just one output parameter of type sometype, in
order to create a set-returning function with output parameters."


>
> Dave
>


--
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: RETURNS TABLE function: ERROR: column reference "word" is ambiguous
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: RETURNS TABLE function: ERROR: column reference "word" is ambiguous