Re: better error description on logical replication

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: better error description on logical replication
Date: 2022-06-29 02:52:02
Message-ID: CAA4eK1JSQsVQ3xc1iAV3+EVkr=Gg1=O-HLV7gGVZAqLLwL4p+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 28, 2022 at 5:50 PM Marcos Pegoraro <marcos(at)f10(dot)com(dot)br> wrote:
>
> I don´t know how to create a patch, maybe someday, but for now I´m just sending this little problem if somebody can solve it.
>
> In a multi schema environment where several tables has same structure is a little bit hard to know which one already has that primary key.
>
> On log I see now on replica server.
> Message:duplicate key value violates unique constraint "pkcustomer"
> Detail: Key (customer_id)=(530540) already exists.
>
> So, I know what table is but I don´t know what schema it belongs.
>

On which version, have you tried this? In HEAD, I am getting below information:
ERROR: duplicate key value violates unique constraint "idx_t1"
DETAIL: Key (c1)=(1) already exists.
CONTEXT: processing remote data for replication origin "pg_16388"
during "INSERT" for replication target relation "public.t1" in
transaction 739 finished at 0/150D640

You can see that CONTEXT has schema information. Will that serve your purpose?

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-06-29 03:06:54 Re: Support logical replication of DDLs
Previous Message Michael Paquier 2022-06-29 01:20:10 Re: Fix proposal for comparaison bugs in PostgreSQL::Version