Re: Fix error message for MERGE foreign tables - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Fix error message for MERGE foreign tables
Date
Msg-id Y0kfaULckKj+AR4E@paquier.xyz
Whole thread Raw
In response to Re: Fix error message for MERGE foreign tables  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Fix error message for MERGE foreign tables
List pgsql-hackers
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.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Move backup-related code to xlogbackup.c/.h
Next
From: Bharath Rupireddy
Date:
Subject: Re: thinko in basic_archive.c