summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2025-04-04 13:12:17 +0900
committerFujii Masao <fujii@postgresql.org>2025-04-04 13:12:17 +0900
commitb29a183c67e1a41f1f77eff378d8c9f5409ee41c (patch)
tree9c169903241d7f110ad773bdff6f99d8798814d7 /src
parent186c586c3717d050e99c14b45f8e52a5d74bc7ba (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/test/recovery/t/006_logical_decoding.pl8
-rw-r--r--src/test/recovery/t/010_logical_decoding_timelines.pl4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl
index f523d8f5933..840cacd73df 100644
--- a/src/test/recovery/t/006_logical_decoding.pl
+++ b/src/test/recovery/t/006_logical_decoding.pl
@@ -144,8 +144,8 @@ SKIP:
is($node_master->psql('postgres', 'DROP DATABASE otherdb'),
3, 'dropping a DB with active logical slots fails');
$pg_recvlogical->kill_kill;
- is($node_master->slot('otherdb_slot')->{'slot_name'},
- undef, 'logical slot still exists');
+ is($node_master->slot('otherdb_slot')->{'plugin'},
+ 'test_decoding', 'logical slot still exists');
}
$node_master->poll_query_until('otherdb',
@@ -154,8 +154,8 @@ $node_master->poll_query_until('otherdb',
is($node_master->psql('postgres', 'DROP DATABASE otherdb'),
0, 'dropping a DB with inactive logical slots succeeds');
-is($node_master->slot('otherdb_slot')->{'slot_name'},
- undef, 'logical slot was actually dropped with DB');
+is($node_master->slot('otherdb_slot')->{'plugin'},
+ '', 'logical slot was actually dropped with DB');
# Test logical slot advancing and its durability.
my $logical_slot = 'logical_slot';
diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl
index 4c8efb3bafc..b72fe7c4f59 100644
--- a/src/test/recovery/t/010_logical_decoding_timelines.pl
+++ b/src/test/recovery/t/010_logical_decoding_timelines.pl
@@ -90,8 +90,8 @@ is( $node_replica->safe_psql(
'postgres', q[SELECT 1 FROM pg_database WHERE datname = 'dropme']),
'',
'dropped DB dropme on standby');
-is($node_master->slot('dropme_slot')->{'slot_name'},
- undef, 'logical slot was actually dropped on standby');
+is($node_master->slot('dropme_slot')->{'plugin'},
+ '', 'logical slot was actually dropped on standby');
# Back to testing failover...
$node_master->safe_psql('postgres',