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

Reply via email to