Re: fix for PL/PgSQL segfault - Mailing list pgsql-patches

From Tom Lane
Subject Re: fix for PL/PgSQL segfault
Date
Msg-id 26229.1042742868@sss.pgh.pa.us
Whole thread Raw
In response to Re: fix for PL/PgSQL segfault  (Neil Conway <neilc@samurai.com>)
List pgsql-patches
Neil Conway <neilc@samurai.com> writes:
>> Then, if rec->tup is found to be NULL in RETURN NEXT, that means no
>> attempt has ever been made to assign to the variable.  I'm undecided
>> about whether that case should return nulls as per your patch, or should
>> raise an error.

> It seems a little inconsistent to treat a "never-assigned-to" variable
> differently than one which has been the target of a SELECT INTO that
> returns zero rows, doesn't it?

Not entirely; the SELECT INTO is sufficient to determine the rowtype of
the variable, even if it can't stuff any data into the columns.  Thus,
for example, we can allow assignment to a field of the record variable
after such a select, whereas we really can't support it when the record
variable is completely without-form-and-void.  In the case of RETURN
NEXT, we are able to check that the record's rowtype matches what was
expected.

            regards, tom lane

pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: ALTER TABLE .. SET WITHOUT OIDS -- ROUND 2
Next
From: Tom Lane
Date:
Subject: Re: replace oidrand() with random_sample()