BUG #15784: logical replication replicate data of type array for operation insert but update/delete/truncate

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: zhq651(at)126(dot)com
Subject: BUG #15784: logical replication replicate data of type array for operation insert but update/delete/truncate
Date: 2019-04-28 06:47:22
Message-ID: 15784-73e9a9446691ce06@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15784
Logged by: DamionZ Zhao
Email address: zhq651(at)126(dot)com
PostgreSQL version: 11.2
Operating system: linux
Description:

in publisher
========
--1. create table & publication and insert some data
create table HA_LOGICAL_REPLICATION_TAB_005(id int primary key, name text,
array1 text[], array2 integer[3][3]);
CREATE TABLE
insert into HA_LOGICAL_REPLICATION_TAB_005 values
(generate_series(1,3),'a','{a,b,c,d}','{{1,2,3},{4,5,6},{7,8,9}}');
INSERT 0 3
create publication ha_logical_replication_pub_005 for table
HA_LOGICAL_REPLICATION_TAB_005;
CREATE PUBLICATION
select
pubname,rolname,puballtables,pubinsert,pubupdate,pubdelete,pubtruncate from
pg_publication,pg_authid where pubname='ha_logical_replication_pub_005' and
pubowner = pg_authid.oid;
pubname | rolname | puballtables | pubinsert |
pubupdate | pubdelete | pubtruncate
--------------------------------+---------+--------------+-----------+-----------+-----------+-------------
ha_logical_replication_pub_005 | replica | f | t | t
| t | t
(1 row)

in subscriber
========
--2.create same table as in publisher
create table HA_LOGICAL_REPLICATION_TAB_005(id int, name text, array1
text[], array2 integer[3][3]);
CREATE TABLE

--3.create publication for ha_logical_replication_pub_005
create subscription ha_logical_replication_sub_005 connection
'hostaddr=${master_ip} port=${master_port} user=replica dbname=REGRESSION'
publication ha_logical_replication_pub_005;
CREATE SUBSCRIPTION

--4. check initial data has coped.-------yes,it is ok.
select * from HA_LOGICAL_REPLICATION_TAB_005 order by id;"
id | name | array1 | array2
----+------+-----------+---------------------------
1 | a | {a,b,c,d} | {{1,2,3},{4,5,6},{7,8,9}}
2 | a | {a,b,c,d} | {{1,2,3},{4,5,6},{7,8,9}}
3 | a | {a,b,c,d} | {{1,2,3},{4,5,6},{7,8,9}}
(3 rows)

in publisher
========
--5.try more in publisher
insert into HA_LOGICAL_REPLICATION_TAB_005 values
(generate_series(5,7),'b','{x,y,z}','{{11,12,13},{14,15,16}}');
INSERT 0 3
update HA_LOGICAL_REPLICATION_TAB_005 set array1 = '{o,p,q}' where id=1;
UPDATE 1
delete from HA_LOGICAL_REPLICATION_TAB_005 where id=3;
DELETE 1
select * from HA_LOGICAL_REPLICATION_TAB_005 order by id;

id | name | array1 | array2
----+------+-----------+---------------------------
1 | a | {o,p,q} | {{1,2,3},{4,5,6},{7,8,9}}
2 | a | {a,b,c,d} | {{1,2,3},{4,5,6},{7,8,9}}
5 | b | {x,y,z} | {{11,12,13},{14,15,16}}
6 | b | {x,y,z} | {{11,12,13},{14,15,16}}
7 | b | {x,y,z} | {{11,12,13},{14,15,16}}

in subscriber
========
--6.what happend in subscriber? will be same as in publisher???
select * from HA_LOGICAL_REPLICATION_TAB_005 order by id;
id | name | array1 | array2
----+------+-----------+---------------------------
1 | a | {a,b,c,d} | {{1,2,3},{4,5,6},{7,8,9}}
2 | a | {a,b,c,d} | {{1,2,3},{4,5,6},{7,8,9}}
3 | a | {a,b,c,d} | {{1,2,3},{4,5,6},{7,8,9}}
5 | b | {x,y,z} | {{11,12,13},{14,15,16}}
6 | b | {x,y,z} | {{11,12,13},{14,15,16}}
7 | b | {x,y,z} | {{11,12,13},{14,15,16}}
(6 rows)

Let me summarize what I test, *insert* operation can be replicated to
subscriber,but *update/delete/truncate* operation not.
Please make sure it is ok?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2019-04-28 11:14:33 Re: BUG #15784: logical replication replicate data of type array for operation insert but update/delete/truncate
Previous Message Tom Lane 2019-04-28 04:55:12 Re: BUG #15783: Fail to select with a function in FROM clause plus another table