Re: How is this possible "publication does not exist" - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: How is this possible "publication does not exist"
Date
Msg-id 20220805.130944.1989619924314333193.horikyota.ntt@gmail.com
Whole thread Raw
In response to Re: How is this possible "publication does not exist"  (Marco Slot <marco.slot@gmail.com>)
List pgsql-hackers
At Thu, 4 Aug 2022 10:56:45 +0200, Marco Slot <marco.slot@gmail.com> wrote in 
> On Wed, Aug 11, 2021 at 1:37 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> > I think it is and the context is generated via
> > output_plugin_error_callback. Is this reproducible for you and if so,
> > can you share a test case or some steps to reproduce this? Does this
> > work and suddenly start giving errors or it happens the very first
> > time you tried to set up publication/subscription? I think some more
> > details are required about your setup and steps to analyze this
> > problem. You might want to check publication-side logs but not sure if
> > get any better clue there.
> 
> This seems to regularly reproduce the issue on PostgreSQL 14.4:
> 
> drop subscription if exists local_sub;
> drop publication if exists local_pub;
> drop table if exists local;
> 
> select pg_create_logical_replication_slot('test','pgoutput');
> create table local (x int, y int);
> insert into local values (1,2);
> create publication local_pub for table local;
> create subscription local_sub connection 'host=localhost port=5432'
> publication local_pub with (create_slot = false, slot_name = 'test',
> copy_data = false);

> The local_pub does appear in pg_publication, but it seems a bit like
> the change_cb is using an old snapshot when reading from the catalog
> in GetPublicationByName.

Yes.  So the slot should be created *after* the publication is
created.  A discussion [1] was held on allowing missing publications
in such a case but it has not been rached a conclusion..

[1] https://www.postgresql.org/message-id/CAA4eK1LwQAEPJMTwVe3UYODeNMkK2QHf-WZF5aXp5ZcjDRcrUA%40mail.gmail.com

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints
Next
From: Amit Kapila
Date:
Subject: Re: Handle infinite recursion in logical replication setup