Re: Errors with schema migration and logical replication — expected? - Mailing list pgsql-general

From Mike Lissner
Subject Re: Errors with schema migration and logical replication — expected?
Date
Msg-id CAMp9=EzR8SXPWRSYSkh2e3FUdaKJB_BzevtzByZG9Qx_36Jm9w@mail.gmail.com
Whole thread Raw
In response to Re: Errors with schema migration and logical replication — expected?  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Errors with schema migration and logical replication — expected?  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general


On Tue, Dec 11, 2018 at 3:10 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:

>     Well, I was able to fix this by briefly allowing nulls on the
>     subscriber, letting it catch up with the publisher, setting all
>     nulls to empty strings (a Django convention), and then disallowing
>     nulls again. After letting it catch up, there were 118 nulls on the
>     subscriber in this column:

So recap_sequence_number is not actually a number, it is a code?

It has sequential values, but they're not necessarily numbers.
 

>
>     I appreciate all the responses. I'm scared to say so, but I think
>     this is a bug in logical replication. Somehow a null value appeared
>     at the subscriber that was never in the publisher.
>
>     I also still have this question/suggestion from my first email:
>
>      > Is the process for schema migrations documented somewhere beyond
>     the above?

Not that I know of. It might help, if possible, to detail the steps in
the migration. Also what program you used to do it. Given that is Django
I am assuming some combination of migrate, makemigrations and/or sqlmigrate.

Pretty simple/standard, I think:
 - Changed the code.
 - Generated the migration using manage.py makemigration
 - Generated the SQL using sqlmigrate
 - Ran the migration using manage.py migrate on the master and using psql on the replica
 
Mike

pgsql-general by date:

Previous
From: Srinivas
Date:
Subject: Stack Builder for pgAgent on Production
Next
From: Fabio Pardi
Date:
Subject: Re: Idle connections / sessions