Re: Logical replication can be broken by domain constraint with NOT VALID option

From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: Euler Taveira <euler(at)timbira(dot)com(dot)br>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Logical replication can be broken by domain constraint with NOT VALID option
Date: 2019-11-05 17:50:37
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On 05/11/2019 20:21, Euler Taveira wrote:
> Em dom., 3 de nov. de 2019 às 23:33, Andrey Lepikhov
> <a(dot)lepikhov(at)postgrespro(dot)ru> escreveu:
>> If this is the only reason, I propose a new version of the patch (see in
>> attachment). It is satisfy the "Paranoid safety" rule.
> I don't think that is acceptable either. If you have different schemas
> (even for a small period of time), you should handle it dropping and
> recreating the constraints.

Changing schema is a big deal. But adding a constraint with "not valid"
option can be used frequently. May be for change phone numbers format,
for example.

> Logical replication is far from a complete
> feature. There should be cases that someone wants to enforce even the
> FK constraints in the subscriber. I certainly wouldn't like to open
> that can of worms. Relaxing constraints could lead to inconsistent
> datasets across nodes. If you want to accept constraint violation,
> drop the constraints.

May be logical replication is incomplete. But it is no argument to not
fix an errors that we found.
In v2 version of the patch constraints are suppressed only for old
version of the tuple that used for search in the heap and can't be
applied. In this sense we do not relaxing any constraints.

Andrey Lepikhov
Postgres Professional
The Russian Postgres Company

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2019-11-05 19:10:39 Re: BUG #16095: Segfault while executing trigger
Previous Message Tom Lane 2019-11-05 17:38:32 Re: BUG #16095: Segfault while executing trigger