pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Logical Replication postgres 10.5
4+ messages / 3 participants
[nested] [flat]

* Logical Replication postgres 10.5
@ 2019-05-28 05:21  Mai Peng <maily.peng@webedia-group.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Mai Peng @ 2019-05-28 05:21 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Hello,
Is Logical Replication ignore foreign key constraint ? How does it possible ?
Thank you





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Logical Replication postgres 10.5
@ 2019-05-28 05:59  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Mai Peng <maily.peng@webedia-group.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Laurenz Albe @ 2019-05-28 05:59 UTC (permalink / raw)
  To: Mai Peng <maily.peng@webedia-group.com>; pgsql-admin@lists.postgresql.org

On Tue, 2019-05-28 at 07:21 +0200, Mai Peng wrote:
> Is Logical Replication ignore foreign key constraint ? How does it possible ?

Can you specify what you mean by "ignoring foreign key constraints"?
Like, some SQL that demonstrates what you are talking about.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Logical Replication postgres 10.5
@ 2019-05-28 07:19  Achilleas Mantzios <achill@matrix.gatewaynet.com>
  parent: Mai Peng <maily.peng@webedia-group.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Achilleas Mantzios @ 2019-05-28 07:19 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

On 28/5/19 8:21 π.μ., Mai Peng wrote:
> Hello,
> Is Logical Replication ignore foreign key constraint ? How does it possible ?
The apply process on the subscriber runs with |session_replication_role| set to |replica, this limits trigger firing, excluding normal triggers . FK constraints in pgsql are implemented with triggers, 
hence the behavior you are observing.
|
> Thank you
>
>


-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Logical Replication postgres 10.5
@ 2019-05-28 08:09  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 0 replies; 4+ messages in thread

From: Laurenz Albe @ 2019-05-28 08:09 UTC (permalink / raw)
  To: Mai Peng <maily.peng@webedia-group.com>; +Cc: pgsql-admin@lists.postgresql.org

Please always include the mailing list in your replies.

Mai Peng wrote:
> Le 28 mai 2019 à 07:59, Laurenz Albe <laurenz.albe@cybertec.at> a écrit:
> 
> > On Tue, 2019-05-28 at 07:21 +0200, Mai Peng wrote:
> > > Is Logical Replication ignore foreign key constraint ? How does it possible ?
> > 
> > Can you specify what you mean by "ignoring foreign key constraints"?
> > Like, some SQL that demonstrates what you are talking about.
>
> The table that stores primary keys is empty, and the table with foreign keys still replicates.

That is because "session_replication_role" is set to "replica" when changes
are replicated.  This prevents foreign key constraints from being checked.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2019-05-28 08:09 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 05:21 Logical Replication postgres 10.5 Mai Peng <maily.peng@webedia-group.com>
2019-05-28 05:59 ` Laurenz Albe <laurenz.albe@cybertec.at>
2019-05-28 08:09   ` Laurenz Albe <laurenz.albe@cybertec.at>
2019-05-28 07:19 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox