From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Mike Lissner <mlissner@michaeljaylissner.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Errors with schema migration and logical replication — expected?
Date: Sun, 9 Dec 2018 12:42:57 -0800
Message-ID: <fe304faa-8470-b3dc-ed3a-e38af587c5d7@aklaver.com> (raw)
In-Reply-To: <CAMp9=EyitOD8ODYxWZGpJ6dihAKAoMYa_Lza899qBCub_yQY5Q@mail.gmail.com>
References: <CAMp9=Eydz258bTK-7=upANs+Pff4wYymQuG=uNjeupCCrbpKFQ@mail.gmail.com>
<42bcb35c-9173-bb9e-bda6-ea5c5950119b@aklaver.com>
<CAMp9=Eypj1cNtnoW8ahFV25mwx8LjTn1x2quPUE-H6tE+D_9pA@mail.gmail.com>
<953748cf-7271-7230-9158-178c8e4f475e@aklaver.com>
<CAMp9=EyitOD8ODYxWZGpJ6dihAKAoMYa_Lza899qBCub_yQY5Q@mail.gmail.com>
On 12/9/18 10:47 AM, Mike Lissner wrote:
>
> My contention is that for all these reasons, there should *never* have
> been a null value in that column on master.
>
>
> > column ever had a null value and I tried to run a DDL to add a null
> > constraint, the DDL would have failed, right?
> >
> > Something feels wrong here, the more I think about it.
>
> A start would be to figure out what generated?:
>
> failing row contains (48064261, 2018-12-07 04:48:40.388377+00,
> 2018-12-07 04:48:40.388402+00, null, 576, , 4571214, null, null)
>
>
> Yes, I completely agree. I can't think of any way that that should have
> ever been created.
1) Using psql have you verified that NOT NULL is set on that column on
the publisher?
2) And that the row that failed in the subscriber is in the publisher table.
3) That there are no NULL values in the publisher column?
Whatever the answers to 1), 2) and 3) are the next question is:
4) Do you want/need recap_sequence_number to be NOT NULL.
a) If not then you could leave things as they are.
b) If so then you:
1) Have to figure out what is sending NULL values to the column.
Maybe a model that has null=True set when it shouldn't be?
A Form/ModelForm that is allowing None/Null?
Some code that is operating outside the ORM e.g. doing a
direct query using from django.db import connection.
2) Clean up the NULL values in the column in the subscriber
and/or publisher.
>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, mlissner@michaeljaylissner.com
Subject: Re: Errors with schema migration and logical replication — expected?
In-Reply-To: <fe304faa-8470-b3dc-ed3a-e38af587c5d7@aklaver.com>
References: <CAMp9=Eydz258bTK-7=upANs+Pff4wYymQuG=uNjeupCCrbpKFQ@mail.gmail.com> <42bcb35c-9173-bb9e-bda6-ea5c5950119b@aklaver.com> <CAMp9=Eypj1cNtnoW8ahFV25mwx8LjTn1x2quPUE-H6tE+D_9pA@mail.gmail.com> <953748cf-7271-7230-9158-178c8e4f475e@aklaver.com> <CAMp9=EyitOD8ODYxWZGpJ6dihAKAoMYa_Lza899qBCub_yQY5Q@mail.gmail.com> <fe304faa-8470-b3dc-ed3a-e38af587c5d7@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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