Re: manipulate and return row inside a function

Поиск
Список
Период
Сортировка
От Claudio Poli
Тема Re: manipulate and return row inside a function
Дата
Msg-id CANp6Qo+XW=9u7LE4aMCT+yhOLyWxBv8ZU0bBg6T2HxPT_T0n2w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: manipulate and return row inside a function  (Luca Ferrari <fluca1978@infinito.it>)
Список pgsql-novice
I solved it with using COALESCE.

Best,
c.


On Thu, Nov 14, 2013 at 9:03 AM, Luca Ferrari <fluca1978@infinito.it> wrote:
On Thu, Nov 14, 2013 at 8:50 AM, Claudio Poli <masterkain@gmail.com> wrote:
> some other things I'm trying:
>
>           SELECT
>             pick_artist(album_artist, artist) AS artist,
>
>
>
>         CREATE OR REPLACE FUNCTION pick_artist(album_artist varchar, album
> varchar)
>         RETURNS varchar AS $$
>           BEGIN
>             IF album_artist IS NULL THEN RETURN album;
>             ELSIF album_artist = '' THEN RETURN album;
>             ELSE RETURN album_artist;
>             END IF;
>           END;
>         $$ LANGUAGE plpgsql;
>
>

This works fine for me:
select * from pick_artist( ROW('a','b') );
on 9.3.
I don't know what is complaining about in your case.

Luca

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

Предыдущее
От: Luca Ferrari
Дата:
Сообщение: Re: manipulate and return row inside a function
Следующее
От: Zhan Li
Дата:
Сообщение: How can I call the method in OPTIMIZER_DEBUG?