Re: Improve the error message for logical replication of regular column to generated column. - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Improve the error message for logical replication of regular column to generated column.
Date
Msg-id CAA4eK1Lo=Q45G8NiNrkA9PJ=r1miCdbFdN5e3vwiKt_t1=NReg@mail.gmail.com
Whole thread Raw
In response to Re: Improve the error message for logical replication of regular column to generated column.  (Peter Smith <smithpb2250@gmail.com>)
Responses Re: Improve the error message for logical replication of regular column to generated column.
List pgsql-hackers
On Mon, Nov 25, 2024 at 8:50 AM Peter Smith <smithpb2250@gmail.com> wrote:
>
> 5.
> As I reported above (#2), I think it is better to check for empty BMS
> in the caller because then the code is easier to read. Also, you need
> to comment on which of these 2 errors will take precedence because if
> there are simultaneous problems you are still only reporting one kind
> of error at a time.
>
> SUGGESTION:
> /*
>  * Report any missing or generated columns. Note, if there are both
>  * kinds then the 'missing' error takes precedence.
>  */
> if (!bms_is_empty(missingatts))
>   logicalrep_report_missing_and_gen_attrs(remoterel, missingatts,
>                                           true);
> if (!bms_is_empty(generatedattrs))
>   logicalrep_report_missing_and_gen_attrs(remoterel, generatedattrs,
>                                           false);
>

This and the proposed coding pattern by patch look odd to me. We
should have a single call to logicalrep_report_missing_and_gen_attrs()
and pass both missing and generated maps to the function. Then, let
the function display the appropriate ERROR message.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: wenhui qiu
Date:
Subject: Re: UUID v7
Next
From: Richard Guo
Date:
Subject: Re: POC, WIP: OR-clause support for indexes