Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash - Mailing list pgsql-hackers

From David Zhang
Subject Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash
Date
Msg-id 162828832381.31964.4684258502930459931.pgcf@coridan.postgresql.org
Whole thread Raw
In response to [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash  ("Drouvot, Bertrand" <bdrouvot@amazon.com>)
Responses Re: [UNVERIFIED SENDER] Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash
List pgsql-hackers
Hi Drouvot,
I can reproduce the issue you mentioned on REL_12_STABLE as well as Master branch, but the patch doesn't apply to
REL_12_STABLE.After applied it to Master branch, it returns some wired result when run the query in the first time. 
 
As you can see in the log below, after the first time execute the query `select * from
pg_logical_slot_get_changes('bdt_slot',null, null);` it returns some extra data.
 
david:postgres$ psql -d postgres
psql (15devel)
Type "help" for help.

postgres=# \q
david:postgres$ psql -d postgres
psql (15devel)
Type "help" for help.

postgres=# select pg_create_logical_replication_slot('bdt_slot','test_decoding');
 pg_create_logical_replication_slot 
------------------------------------
 (bdt_slot,0/1484FA8)
(1 row)

postgres=# CREATE TABLE tbl1 (a INT, b TEXT);
CREATE TABLE
postgres=# CREATE TABLE tbl2 (a INT);
CREATE TABLE
postgres=# ALTER TABLE tbl1 ALTER COLUMN b SET STORAGE EXTERNAL;
ALTER TABLE
postgres=# 
postgres=# BEGIN;
BEGIN
postgres=*# INSERT INTO tbl1 VALUES(1, repeat('a', 4000)) ;
INSERT 0 1
postgres=*# ALTER TABLE tbl1 ADD COLUMN id serial primary key;
ALTER TABLE
postgres=*# INSERT INTO tbl2 VALUES(1);
INSERT 0 1
postgres=*# commit;
COMMIT
postgres=# 
postgres=# select * from pg_logical_slot_get_changes('bdt_slot', null, null);
    lsn    | xid |
                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                         data        
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 

                                     
 



-----------+-----+--------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------
postgres=# select * from pg_logical_slot_get_changes('bdt_slot', null, null);
 lsn | xid | data 
-----+-----+------
(0 rows)

postgres=# select * from pg_logical_slot_get_changes('bdt_slot', null, null);
 lsn | xid | data 
-----+-----+------
(0 rows)

postgres=# select * from pg_logical_slot_get_changes('bdt_slot', null, null);
 lsn | xid | data 
-----+-----+------
(0 rows)

postgres=# 

Thank you,
David

pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Numeric x^y for negative x
Next
From: Masahiko Sawada
Date:
Subject: Re: [BUG] wrong refresh when ALTER SUBSCRIPTION ADD/DROP PUBLICATION