From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | PegoraroF10 <marcos(at)f10(dot)com(dot)br>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to discover what table is |
Date: | 2020-03-11 17:50:56 |
Message-ID: | e40d96c5-740b-e21d-bd3c-5306e0282bf3@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 3/11/20 1:22 AM, PegoraroF10 wrote:
> Well, for now it´s solved but I´ll explain what happens to solve it better on
> future.
> Suppose on Master you have a database with hundreds of schemas with same
> structure, so table Customer happens 500 times on that DB. That database
> being replicated with publication/subscription for all tables model, just
> that. Now to have new schemas added to this database you go to replica,
> create them with structure only, go to master and create them with data, go
> back to replica and refresh publication. But then imagine that one of those
> schemas you´ve created on replica with data. This is where problem occurs
> and message is just PK of Table Customer is duplicated but is not easy to
> find which table because I´ll have that table and that key on 90% of my
> schemas. If, on error message we just have which schema belongs that table
> would be great.
Some digging found that the ERROR uses get_rel_name for the relation
name and that led to:
~/src/backend/utils/cache/lsyscache.c
/*
* get_rel_name
* Returns the name of a given relation.
*
* Returns a palloc'd copy of the string, or NULL if no such relation.
*
* NOTE: since relation name is not unique, be wary of code that uses this
* for anything except preparing error messages.
*/
Going any further is going to need someone with more knowledge of the
above to chime in.
>
>
>
> --
> Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2020-03-11 17:57:46 | Re: Streaming replication - 11.5 |
Previous Message | Torsten Krah | 2020-03-11 17:39:52 | Re: Force WAL cleanup on running instance |