aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-03-15 17:55:12 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-03-15 17:55:12 +0200
commitd802ff06d0216d59aab3ddba6cb158d1f4b014db (patch)
tree6d88b5260f3afbc92ade58785fad9a42fd4b4755
parent85f65d7a26fc24ad9711aa5f1ca7e20ea3ea77e6 (diff)
downloadpostgresql-d802ff06d0216d59aab3ddba6cb158d1f4b014db.tar.gz
postgresql-d802ff06d0216d59aab3ddba6cb158d1f4b014db.zip
Fix backstop in gin test if injection point is not reached
Per Tom Lane's observation that the test got stuck in infinite loop if the injection_points module was not loaded. It was supposed to give up after 10000 iterations, but the backstop was broken. Discussion: https://www.postgresql.org/message-id/2498595.1710511222%40sss.pgh.pa.us
-rw-r--r--src/test/modules/gin/expected/gin_incomplete_splits.out5
-rw-r--r--src/test/modules/gin/sql/gin_incomplete_splits.sql5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/test/modules/gin/expected/gin_incomplete_splits.out b/src/test/modules/gin/expected/gin_incomplete_splits.out
index 9a60f8c128a..822b78cffc4 100644
--- a/src/test/modules/gin/expected/gin_incomplete_splits.out
+++ b/src/test/modules/gin/expected/gin_incomplete_splits.out
@@ -45,6 +45,7 @@ declare
i integer;
begin
-- Insert arrays with 'step' elements each, until an error occurs.
+ i := 0;
loop
begin
select insert_n(next_i, step) into next_i;
@@ -53,12 +54,12 @@ begin
exit;
end;
- -- The caller is expected to set an injection point that eventuall
+ -- The caller is expected to set an injection point that eventually
-- causes an error. But bail out if still no error after 10000
-- attempts, so that we don't get stuck in an infinite loop.
i := i + 1;
if i = 10000 then
- raise 'no error on inserts after ';
+ raise 'no error on inserts after % iterations', i;
end if;
end loop;
diff --git a/src/test/modules/gin/sql/gin_incomplete_splits.sql b/src/test/modules/gin/sql/gin_incomplete_splits.sql
index 4e180b25195..71253b71f3d 100644
--- a/src/test/modules/gin/sql/gin_incomplete_splits.sql
+++ b/src/test/modules/gin/sql/gin_incomplete_splits.sql
@@ -48,6 +48,7 @@ declare
i integer;
begin
-- Insert arrays with 'step' elements each, until an error occurs.
+ i := 0;
loop
begin
select insert_n(next_i, step) into next_i;
@@ -56,12 +57,12 @@ begin
exit;
end;
- -- The caller is expected to set an injection point that eventuall
+ -- The caller is expected to set an injection point that eventually
-- causes an error. But bail out if still no error after 10000
-- attempts, so that we don't get stuck in an infinite loop.
i := i + 1;
if i = 10000 then
- raise 'no error on inserts after ';
+ raise 'no error on inserts after % iterations', i;
end if;
end loop;