Skip to content

Commit b29a183

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 186c586 commit b29a183

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@
144144
is($node_master->psql('postgres', 'DROP DATABASE otherdb'),
145145
3, 'dropping a DB with active logical slots fails');
146146
$pg_recvlogical->kill_kill;
147-
is($node_master->slot('otherdb_slot')->{'slot_name'},
148-
undef, 'logical slot still exists');
147+
is($node_master->slot('otherdb_slot')->{'plugin'},
148+
'test_decoding', 'logical slot still exists');
149149
}
150150

151151
$node_master->poll_query_until('otherdb',
@@ -154,8 +154,8 @@
154154

155155
is($node_master->psql('postgres', 'DROP DATABASE otherdb'),
156156
0, 'dropping a DB with inactive logical slots succeeds');
157-
is($node_master->slot('otherdb_slot')->{'slot_name'},
158-
undef, 'logical slot was actually dropped with DB');
157+
is($node_master->slot('otherdb_slot')->{'plugin'},
158+
'', 'logical slot was actually dropped with DB');
159159

160160
# Test logical slot advancing and its durability.
161161
my $logical_slot = 'logical_slot';

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090
'postgres', q[SELECT 1 FROM pg_database WHERE datname = 'dropme']),
9191
'',
9292
'dropped DB dropme on standby');
93-
is($node_master->slot('dropme_slot')->{'slot_name'},
94-
undef, 'logical slot was actually dropped on standby');
93+
is($node_master->slot('dropme_slot')->{'plugin'},
94+
'', 'logical slot was actually dropped on standby');
9595

9696
# Back to testing failover...
9797
$node_master->safe_psql('postgres',

0 commit comments

Comments
 (0)