Re: RETURNS TABLE function: ERROR: column reference "word" is ambiguous
От | Adrian Klaver |
---|---|
Тема | Re: RETURNS TABLE function: ERROR: column reference "word" is ambiguous |
Дата | |
Msg-id | ca8b37b8-8734-0594-9b20-cb298b2d36f0@aklaver.com обсуждение исходный текст |
Ответ на | Re: RETURNS TABLE function: ERROR: column reference "word" is ambiguous (Alexander Farber <alexander.farber@gmail.com>) |
Список | pgsql-general |
On 08/10/2016 10:05 AM, Alexander Farber wrote: > 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); With RETURN NEXT you have to build the table a row at a time where RETURN NEXT is in a LOOP. You also need to assign to the OUT parameters, in this case the fields in your RETURN TABLE. So something like, inside LOOP: word := upper(_word); score := _score; RETURN NEXT; If I am following correctly. > > Regards > Alex -- Adrian Klaver adrian.klaver@aklaver.com
В списке pgsql-general по дате отправления: