Re: manipulate and return row inside a function - Mailing list pgsql-novice

From Luca Ferrari
Subject Re: manipulate and return row inside a function
Date
Msg-id CAKoxK+7vobCvnkqwkyz7wXZFYO9PiDrbz+TbVVih+H08zSDRkA@mail.gmail.com
Whole thread Raw
In response to Re: manipulate and return row inside a function  (Claudio Poli <masterkain@gmail.com>)
Responses Re: manipulate and return row inside a function
List pgsql-novice
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 by date:

Previous
From: Luca Ferrari
Date:
Subject: Re: Datatype of a column
Next
From: Claudio Poli
Date:
Subject: Re: manipulate and return row inside a function