Skip to content

Commit 5570e10

Browse files
committed
Fix logical decoding regression tests to correctly check slot existence.
The regression tests for logical decoding verify whether a logical slot exists or has been dropped. Previously, these tests attempted to retrieve "slot_name" from the result of slot(), but since "slot_name" was not included in the result, slot()->{'slot_name'} always returned undef, leading to incorrect behavior. This commit fixes the issue by checking the "plugin" field in the result of slot() instead, ensuring the tests properly verify slot existence. Back-patch to all supported versions. Author: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/OSCPR01MB149667EC4E738769CA80B7EA5F5AE2@OSCPR01MB14966.jpnprd01.prod.outlook.com Backpatch-through: 13
1 parent a4309e8 commit 5570e10

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/test/recovery/t/006_logical_decoding.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@
158158
is($node_primary->psql('postgres', 'DROP DATABASE otherdb'),
159159
3, 'dropping a DB with active logical slots fails');
160160
$pg_recvlogical->kill_kill;
161-
is($node_primary->slot('otherdb_slot')->{'slot_name'},
162-
undef, 'logical slot still exists');
161+
is($node_primary->slot('otherdb_slot')->{'plugin'},
162+
'test_decoding', 'logical slot still exists');
163163
}
164164

165165
$node_primary->poll_query_until('otherdb',
@@ -168,8 +168,8 @@
168168

169169
is($node_primary->psql('postgres', 'DROP DATABASE otherdb'),
170170
0, 'dropping a DB with inactive logical slots succeeds');
171-
is($node_primary->slot('otherdb_slot')->{'slot_name'},
172-
undef, 'logical slot was actually dropped with DB');
171+
is($node_primary->slot('otherdb_slot')->{'plugin'},
172+
'', 'logical slot was actually dropped with DB');
173173

174174
# Test logical slot advancing and its durability.
175175
# Passing failover=true (last arg) should not have any impact on advancing.

src/test/recovery/t/010_logical_decoding_timelines.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494
'postgres', q[SELECT 1 FROM pg_database WHERE datname = 'dropme']),
9595
'',
9696
'dropped DB dropme on standby');
97-
is($node_primary->slot('dropme_slot')->{'slot_name'},
98-
undef, 'logical slot was actually dropped on standby');
97+
is($node_primary->slot('dropme_slot')->{'plugin'},
98+
'', 'logical slot was actually dropped on standby');
9999

100100
# Back to testing failover...
101101
$node_primary->safe_psql('postgres',

0 commit comments

Comments
 (0)