Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda83b1e

Browse files
committed
Avoid depending on post-UPDATE row order in float4/float8 tests.
While heapam reproduces the insertion order of rows well, updatescan move rows to varying places depending on autovacuum activity.In most regression tests we've guarded against getting variableresults due to that, but float4.sql and float8.sql had escapednotice so far because they update tables that are too small forautovacuum to pay attention to.With increasing interest in non-heap table AMs, it seems worthallowing for update behaviors that are not like heapam's. Hence,add ORDER BY to stabilize the results in case the updates putthe rows in a different order. (We'll continue to assume that aseqscan will reproduce original insertion order, though. Removingthat assumption would require vastly-more-invasive test changes.)Author: Pavel Borisov <pashkin.elfe@gmail.com>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/CALT9ZEExHAnBoBVQzQuWPMKUbapF5-FBO3fdeYG3s2tuWQz1NQ@mail.gmail.com
1 parenteaf5828 commitda83b1e

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

‎src/test/regress/expected/float4-misrounded-input.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,14 @@ SELECT f.f1, @f.f1 AS abs_f1 FROM FLOAT4_TBL f;
308308
UPDATE FLOAT4_TBL
309309
SET f1 = FLOAT4_TBL.f1 * '-1'
310310
WHERE FLOAT4_TBL.f1 > '0.0';
311-
SELECT * FROM FLOAT4_TBL;
311+
SELECT * FROM FLOAT4_TBL ORDER BY 1;
312312
f1
313313
----------------
314-
0
315-
-34.84
316-
-1004.3
317314
-1.2345679e+20
315+
-1004.3
316+
-34.84
318317
-1.2345679e-20
318+
0
319319
(5 rows)
320320

321321
-- test edge-case coercions to integer

‎src/test/regress/expected/float4.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,14 @@ SELECT f.f1, @f.f1 AS abs_f1 FROM FLOAT4_TBL f;
308308
UPDATE FLOAT4_TBL
309309
SET f1 = FLOAT4_TBL.f1 * '-1'
310310
WHERE FLOAT4_TBL.f1 > '0.0';
311-
SELECT * FROM FLOAT4_TBL;
311+
SELECT * FROM FLOAT4_TBL ORDER BY 1;
312312
f1
313313
----------------
314-
0
315-
-34.84
316-
-1004.3
317314
-1.2345679e+20
315+
-1004.3
316+
-34.84
318317
-1.2345679e-20
318+
0
319319
(5 rows)
320320

321321
-- test edge-case coercions to integer

‎src/test/regress/expected/float8.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,14 +648,14 @@ SELECT exp(f.f1) from FLOAT8_TBL f;
648648
ERROR: value out of range: underflow
649649
SELECT f.f1 / '0.0' from FLOAT8_TBL f;
650650
ERROR: division by zero
651-
SELECT * FROM FLOAT8_TBL;
651+
SELECT * FROM FLOAT8_TBL ORDER BY 1;
652652
f1
653653
-----------------------
654-
0
655-
-34.84
656-
-1004.3
657654
-1.2345678901234e+200
655+
-1004.3
656+
-34.84
658657
-1.2345678901234e-200
658+
0
659659
(5 rows)
660660

661661
-- hyperbolic functions

‎src/test/regress/sql/float4.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ UPDATE FLOAT4_TBL
9898
SET f1=FLOAT4_TBL.f1*'-1'
9999
WHEREFLOAT4_TBL.f1>'0.0';
100100

101-
SELECT*FROM FLOAT4_TBL;
101+
SELECT*FROM FLOAT4_TBLORDER BY1;
102102

103103
-- test edge-case coercions to integer
104104
SELECT'32767.4'::float4::int2;

‎src/test/regress/sql/float8.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ SELECT exp(f.f1) from FLOAT8_TBL f;
197197

198198
SELECTf.f1/'0.0'from FLOAT8_TBL f;
199199

200-
SELECT*FROM FLOAT8_TBL;
200+
SELECT*FROM FLOAT8_TBLORDER BY1;
201201

202202
-- hyperbolic functions
203203
-- we run these with extra_float_digits = 0 too, since different platforms

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp