From 3c2a425da71d56edade2d7e2734305e8af778c9a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 30 Aug 2013 21:40:21 -0400 Subject: [PATCH] Improve regression test for #8410. The previous version of the query disregarded the result of the MergeAppend instead of checking its results. Andres Freund --- src/test/regress/expected/inherit.out | 49 +++++++++++++-------------- src/test/regress/sql/inherit.sql | 16 ++++----- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out index 8520281f75..a2ef7ef7cd 100644 --- a/src/test/regress/expected/inherit.out +++ b/src/test/regress/expected/inherit.out @@ -1353,42 +1353,41 @@ ORDER BY x, y; -- exercise rescan code path via a repeatedly-evaluated subquery explain (costs off) SELECT - (SELECT g.i FROM ( - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + ARRAY(SELECT f.i FROM ( + (SELECT d + g.i FROM generate_series(4, 30, 3) d ORDER BY 1) UNION ALL - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + (SELECT d + g.i FROM generate_series(0, 30, 5) d ORDER BY 1) ) f(i) - ORDER BY f.i LIMIT 1) + ORDER BY f.i LIMIT 10) FROM generate_series(1, 3) g(i); - QUERY PLAN ------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------- Function Scan on generate_series g SubPlan 1 -> Limit - -> Result - -> Merge Append - Sort Key: generate_series.generate_series - -> Sort - Sort Key: generate_series.generate_series - -> Function Scan on generate_series - -> Sort - Sort Key: generate_series_1.generate_series - -> Function Scan on generate_series generate_series_1 -(12 rows) + -> Merge Append + Sort Key: ((d.d + g.i)) + -> Sort + Sort Key: ((d.d + g.i)) + -> Function Scan on generate_series d + -> Sort + Sort Key: ((d_1.d + g.i)) + -> Function Scan on generate_series d_1 +(11 rows) SELECT - (SELECT g.i FROM ( - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + ARRAY(SELECT f.i FROM ( + (SELECT d + g.i FROM generate_series(4, 30, 3) d ORDER BY 1) UNION ALL - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + (SELECT d + g.i FROM generate_series(0, 30, 5) d ORDER BY 1) ) f(i) - ORDER BY f.i LIMIT 1) + ORDER BY f.i LIMIT 10) FROM generate_series(1, 3) g(i); - i ---- - 1 - 2 - 3 + array +------------------------------ + {1,5,6,8,11,11,14,16,17,20} + {2,6,7,9,12,12,15,17,18,21} + {3,7,8,10,13,13,16,18,19,22} (3 rows) reset enable_seqscan; diff --git a/src/test/regress/sql/inherit.sql b/src/test/regress/sql/inherit.sql index e88a5847b9..86376554b0 100644 --- a/src/test/regress/sql/inherit.sql +++ b/src/test/regress/sql/inherit.sql @@ -442,21 +442,21 @@ ORDER BY x, y; -- exercise rescan code path via a repeatedly-evaluated subquery explain (costs off) SELECT - (SELECT g.i FROM ( - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + ARRAY(SELECT f.i FROM ( + (SELECT d + g.i FROM generate_series(4, 30, 3) d ORDER BY 1) UNION ALL - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + (SELECT d + g.i FROM generate_series(0, 30, 5) d ORDER BY 1) ) f(i) - ORDER BY f.i LIMIT 1) + ORDER BY f.i LIMIT 10) FROM generate_series(1, 3) g(i); SELECT - (SELECT g.i FROM ( - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + ARRAY(SELECT f.i FROM ( + (SELECT d + g.i FROM generate_series(4, 30, 3) d ORDER BY 1) UNION ALL - (SELECT * FROM generate_series(1, 2) ORDER BY 1) + (SELECT d + g.i FROM generate_series(0, 30, 5) d ORDER BY 1) ) f(i) - ORDER BY f.i LIMIT 1) + ORDER BY f.i LIMIT 10) FROM generate_series(1, 3) g(i); reset enable_seqscan; -- 2.40.0