Re: plpgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dim45(at)gmx(dot)net
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: plpgsql
Date: 2005-02-12 09:12:56
Message-ID: 19870.1108199576@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

dim <dim45(at)gmx(dot)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

In response to

  • plpgsql at 2005-02-12 08:49:48 from dim

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message dim 2005-02-12 10:01:27 Re: plpgsql
Previous Message dim 2005-02-12 08:49:48 plpgsql