BUG #16299: pg_subscription_rel inconsistency post create database from template with disabled subscription

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #16299: pg_subscription_rel inconsistency post create database from template with disabled subscription
Дата
Msg-id 16299-0e518acf3ff4956e@postgresql.org
обсуждение исходный текст
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16299
Logged by:          Eric Cyr
Email address:      eric.cyr@gmail.com
PostgreSQL version: 12.1
Operating system:   Ubuntu
Description:

Hi,

I stumbled upon what seems to be inconsistency in the pg_subscription_rel
catalog table.
This was noticed after creating a new database using a template which had
disabled subscription.
Although Im sending this to bug report, it didn't cause any issue so far.

Here are the steps to reproduce the situation:


--

CREATE ROLE usr_replication REPLICATION PASSWORD 'test' LOGIN;

--

CREATE DATABASE publisher;

\c publisher

CREATE SCHEMA test;

GRANT USAGE ON SCHEMA test TO usr_replication;

CREATE TABLE test.pub_table
(
    id SERIAL,
    val1 text
);

GRANT ALL ON TABLE test.pub_table TO usr_replication;

CREATE PUBLICATION pub FOR TABLE test.pub_table;

SELECT pg_create_logical_replication_slot('pub_rslot_1', 'pgoutput');

--

CREATE DATABASE subscriber;

\c subscriber

CREATE SCHEMA test;

GRANT USAGE ON SCHEMA test TO usr_replication;

CREATE TABLE test.pub_table
(
    id SERIAL,
    val1 text
);

GRANT ALL ON TABLE test.pub_table TO usr_replication;

CREATE SUBSCRIPTION sub
    CONNECTION 'dbname=publisher user=usr_replication password=test'
    PUBLICATION pub
    WITH ( create_slot = FALSE, slot_name = 'pub_rslot_1' )
;

--

\c subscriber

ALTER SUBSCRIPTION sub DISABLE;

\c template1

CREATE DATABASE subscriber_from_template TEMPLATE subscriber;

\c subscriber_from_template

\dRs
-- 0 rows

SELECT * FROM pg_subscription WHERE subdbid = (SELECT oid FROM pg_database
WHERE datname = current_database());
-- 0 rows

SELECT * FROM pg_subscription_rel;
-- 1 rows





Thank you
Have a nice day
Eric


Side note
Maybe, in the meantime, a mention could be added to the documentation.

Reference:
51.54. pg_subscription_rel

"This catalog only contains tables known to the subscription after running
either CREATE SUBSCRIPTION or ALTER SUBSCRIPTION ... REFRESH PUBLICATION."
https://www.postgresql.org/docs/12/catalog-pg-subscription-rel.html


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Richard Guo
Дата:
Сообщение: Re: Optimizer Doesn't Push Down Where Expressions on Rollups
Следующее
От: "Demarest, Jamie"
Дата:
Сообщение: RE: Postgresql create a core while trying log a message to syslog