Re: plpgsql - Mailing list pgsql-novice

From Tom Lane
Subject Re: plpgsql
Date
Msg-id 19870.1108199576@sss.pgh.pa.us
Whole thread Raw
In response to plpgsql  (dim <dim45@gmx.net>)
Responses Re: plpgsql  (dim <dim45@gmx.net>)
List pgsql-novice
dim <dim45@gmx.net> writes:
> The error is "Function returning row cannot return null
> value". Is the only solution to this problem to declare function get_a
> to return "SET OF a" ?

Might not be the only solution, but IMHO it's the correct solution.
Your underlying SELECT returns either a row, or no row (or possibly
more than one row?) so the function should too.

> Am I missing anything or is
> record assignment not possible in plpgsql?

Your example works fine for me in PG 8.0.  There were some improvements
in this area since 7.*, though I'm not sure offhand whether they were
material to this particular case.

            regards, tom lane

pgsql-novice by date:

Previous
From: dim
Date:
Subject: plpgsql
Next
From: dim
Date:
Subject: Re: plpgsql