Joe Conway <mail@joeconway.com> writes:
> I'd like to consider the attached a bugfix and apply for the upcoming
> 7.3.6 and 7.4.2 releases, as well as cvs tip. Any comments/objections?
Two nitpicks (each applying in 2 places):
> ! if (!rsinfo)
> ! ereport(ERROR,
> ! (errcode(ERRCODE_SYNTAX_ERROR),
> ! errmsg("returning setof record is not " \
> ! "allowed in this context")));
> !
First, testing for null rsinfo isn't sufficient, since the resultinfo
mechanism could be used for other things; you need an IsA test too.
Second, is "syntax error" really the most appropriate classification for
this? Compare the code in functions.c:
ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
if (rsi && IsA(rsi, ReturnSetInfo))
rsi->isDone = ExprEndResult;
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("set-valued function called in context that cannot accept a set")));
(Also, the errmsg text seems a bit out of line with the wording of
comparable errors, but I can't offer better text offhand.)
regards, tom lane