Skip to content

Commit 0d22daa

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 a8a9189 commit 0d22daa

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
@@ -149,8 +149,8 @@
149149
is($node_primary->psql('postgres', 'DROP DATABASE otherdb'),
150150
3, 'dropping a DB with active logical slots fails');
151151
$pg_recvlogical->kill_kill;
152-
is($node_primary->slot('otherdb_slot')->{'slot_name'},
153-
undef, 'logical slot still exists');
152+
is($node_primary->slot('otherdb_slot')->{'plugin'},
153+
'test_decoding', 'logical slot still exists');
154154
}
155155

156156
$node_primary->poll_query_until('otherdb',
@@ -159,8 +159,8 @@
159159

160160
is($node_primary->psql('postgres', 'DROP DATABASE otherdb'),
161161
0, 'dropping a DB with inactive logical slots succeeds');
162-
is($node_primary->slot('otherdb_slot')->{'slot_name'},
163-
undef, 'logical slot was actually dropped with DB');
162+
is($node_primary->slot('otherdb_slot')->{'plugin'},
163+
'', 'logical slot was actually dropped with DB');
164164

165165
# Test logical slot advancing and its durability.
166166
my $logical_slot = 'logical_slot';

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

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

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

0 commit comments

Comments
 (0)