Re: better error description on logical replication

From: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: better error description on logical replication
Date: 2022-06-29 11:00:31
Message-ID: CAB-JLwYSyUDn6vpNXWQJuoBKANu_dzLmSiaFOxUiEraoXGFeeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I´m using 14.4.
These are some lines with that error, and context is empty.
And yes, if context had this info you wrote would be fine

2022-06-28 08:18:23.600 -03,,,20915,,62b9c77b.51b3,1328,,2022-06-27
12:06:35 -03,4/690182,433844252,ERROR,23505,"duplicate key value violates
unique constraint ""pkcustomer""","Key (customer_id)=(530540) already
exists.",,,,,,,,"","logical replication worker",,5539589780750922391
2022-06-28 08:18:23.609 -03,,,20377,,62bae37f.4f99,1,,2022-06-28 08:18:23
-03,4/690184,0,LOG,00000,"logical replication apply worker for subscription
""sub_replica_5"" has started",,,,,,,,,"","logical replication worker",,0
2022-06-28 08:18:23.929 -03,,,2009,,62b35392.7d9,88468,,2022-06-22 14:38:26
-03,,0,LOG,00000,"background worker ""logical replication worker"" (PID
20915) exited with exit code 1",,,,,,,,,"","postmaster",,0
2022-06-28 08:18:24.151 -03,,,20377,,62bae37f.4f99,2,,2022-06-28 08:18:23
-03,4/690187,433844253,ERROR,23505,"duplicate key value violates unique
constraint ""pkcustomer""","Key (customer_id)=(530540) already
exists.",,,,,,,,"","logical replication worker",,6675519194010520265
2022-06-28 08:18:24.160 -03,,,2009,,62b35392.7d9,88469,,2022-06-22 14:38:26
-03,,0,LOG,00000,"background worker ""logical replication worker"" (PID
20377) exited with exit code 1",,,,,,,,,"","postmaster",,0
2

thanks
Marcos

Em ter., 28 de jun. de 2022 às 23:52, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
escreveu:

> 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 11:11:01 Re: better error description on logical replication
Previous Message Daniel Gustafsson 2022-06-29 10:59:32 Re: OpenSSL 3.0.0 compatibility