diff options
| author | David Rowley <drowley@postgresql.org> | 2023-01-24 12:29:57 +1300 |
|---|---|---|
| committer | David Rowley <drowley@postgresql.org> | 2023-01-24 12:29:57 +1300 |
| commit | 73f77ab508d1514ca604c47b6f56c5dee4dd9025 (patch) | |
| tree | d4cf9139c2fbf70208dd1e6ebf437e423fc9720a /src/test/regress/sql/memoize.sql | |
| parent | 95f62b16a3344e48ecce1ceb2882e5af24c13a1b (diff) | |
Fix LATERAL join test in test memoize.sql
The test in question was meant to be testing Memoize to ensure it worked
correctly when the inner side of the join contained lateral vars, however,
nothing in the lateral subquery stopped it from being pulled up into the
main query, so the planner did that, and that meant no more lateral vars.
Here we add a simple ORDER BY to stop the planner from being able to
pullup the lateral subquery.
Author: Richard Guo
Discussion: https://postgr.es/m/CAMbWs4_LHJaN4L-tXpKMiPFnsCJWU1P8Xh59o0W7AA6UN99=cQ@mail.gmail.com
Backpatch-through: 14, where Memoize was added.
Diffstat (limited to 'src/test/regress/sql/memoize.sql')
| -rw-r--r-- | src/test/regress/sql/memoize.sql | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test/regress/sql/memoize.sql b/src/test/regress/sql/memoize.sql index 17c5b4bfab5..623a9d5114f 100644 --- a/src/test/regress/sql/memoize.sql +++ b/src/test/regress/sql/memoize.sql @@ -47,12 +47,14 @@ WHERE t2.unique1 < 1000; -- Try with LATERAL joins SELECT explain_memoize(' SELECT COUNT(*),AVG(t2.unique1) FROM tenk1 t1, -LATERAL (SELECT t2.unique1 FROM tenk1 t2 WHERE t1.twenty = t2.unique1) t2 +LATERAL (SELECT t2.unique1 FROM tenk1 t2 + WHERE t1.twenty = t2.unique1 ORDER BY 1) t2 WHERE t1.unique1 < 1000;', false); -- And check we get the expected results. SELECT COUNT(*),AVG(t2.unique1) FROM tenk1 t1, -LATERAL (SELECT t2.unique1 FROM tenk1 t2 WHERE t1.twenty = t2.unique1) t2 +LATERAL (SELECT t2.unique1 FROM tenk1 t2 + WHERE t1.twenty = t2.unique1 ORDER BY 1) t2 WHERE t1.unique1 < 1000; -- Reduce work_mem and hash_mem_multiplier so that we see some cache evictions |
