Re: Improve errhint for ALTER SUBSCRIPTION ADD/DROP PUBLICATION

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improve errhint for ALTER SUBSCRIPTION ADD/DROP PUBLICATION
Date: 2022-10-17 10:14:23
Message-ID: CAA4eK1JU2Nsxdodko0WY=7=cNVu638b4k-9e_C75HfLoUssJZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 17, 2022 at 2:41 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> On 2022-Oct-17, Peter Smith wrote:
>
> > On Mon, Oct 17, 2022 at 6:43 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> > > I'm not sure that ERRCODE_SYNTAX_ERROR is the right thing here; sounds
> > > like ERRCODE_FEATURE_NOT_SUPPORTED might be more appropriate.
> >
> > I thought maybe ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE, which would
> > make it the same as similar messages in the same function when
> > incompatible parameters are specified.
>
> Hmm, yeah, I guess that's also a possibility.
>

Right, ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE seems to suite better here.

> Maybe we need a specific errcode, "incompatible logical replication
> configuration", within that class ("object not in prerequisite state" is
> a generic SQLSTATE class 55), given that the class itself is a mishmash
> of completely unrelated things. I think I already mentioned this in
> some other thread ... ah yes:
>
> https://postgr.es/m/20220928084641.xecjrgym476fihtn@alvherre.pgsql
> "incompatible publication definition" 55PR1 is what I suggested then.
>

Yeah, this is another way to deal with it. But, won't it be better to
survey all call sites of ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE and
then try to subdivide it instead of doing it for
subscription/publication cases? I know that is a much bigger ask and
we don't need to do it for this patch but that seems like a more
future-proof way if we can build a consensus for the same.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Damir Belyalov 2022-10-17 10:17:38 Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)
Previous Message Amit Langote 2022-10-17 09:30:48 Bitmapsets as Nodes