Re: Fix error message for MERGE foreign tables

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, bt22nakamorit <bt22nakamorit(at)oss(dot)nttdata(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix error message for MERGE foreign tables
Date: 2022-10-14 08:47:55
Message-ID: 20221014084755.wr747qngksa6dtoi@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022-Oct-14, Michael Paquier wrote:

> On Fri, Oct 14, 2022 at 12:26:19PM +0800, Richard Guo wrote:
> > Maybe something like below, so that we keep it consistent with the case
> > of a foreign table being specified as a target.
> >
> > --- a/contrib/postgres_fdw/postgres_fdw.c
> > +++ b/contrib/postgres_fdw/postgres_fdw.c
> > @@ -1872,6 +1872,13 @@ postgresPlanForeignModify(PlannerInfo *root,
> > returningList,
> > &retrieved_attrs);
> > break;
> > + case CMD_MERGE:
> > + ereport(ERROR,
> > + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> > + errmsg("cannot execute MERGE on relation \"%s\"",
> > + RelationGetRelationName(rel)),
> > +
> > errdetail_relkind_not_supported(rel->rd_rel->relkind)));
> > + break;
>
> Yeah, you should not use an elog(ERROR) for cases that would be faced
> directly by users.

Yeah, I think this just flies undetected until it hits code that doesn't
support the case. I'll add a test and push as Richard suggests, thanks.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"La libertad es como el dinero; el que no la sabe emplear la pierde" (Alvarez)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2022-10-14 08:54:37 pub/sub - specifying optional parameters without values.
Previous Message Alvaro Herrera 2022-10-14 08:46:15 Re: New docs chapter on Transaction Management and related changes