Re: dblink - custom datatypes NOW work :) - Mailing list pgsql-patches

From Tom Lane
Subject Re: dblink - custom datatypes NOW work :)
Date
Msg-id 20327.1077506107@sss.pgh.pa.us
Whole thread Raw
In response to Re: dblink - custom datatypes NOW work :)  (Joe Conway <mail@joeconway.com>)
Responses Re: dblink - custom datatypes NOW work :)  (Joe Conway <mail@joeconway.com>)
List pgsql-patches
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

pgsql-patches by date:

Previous
From: Joe Conway
Date:
Subject: Re: [GENERAL] dblink: rollback transaction
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] dblink: rollback transaction