Skip to content

Commit 9567686

Browse files
committed
Use OFFSET 0 instead of ORDER BY to stop subquery pullup
b762fed recently changed this test to prevent subquery pullup to allow us to test Memoize with lateral_vars. As pointed out by Tom Lane, OFFSET 0 is our standard way of preventing subquery pullups, so do it that way instead. Discussion: https://postgr.es/m/2144818.1674517061@sss.pgh.pa.us Backpatch-through: 14, same as b762fed
1 parent b762fed commit 9567686

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/test/regress/expected/memoize.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ WHERE t2.unique1 < 1000;
6464
SELECT explain_memoize('
6565
SELECT COUNT(*),AVG(t2.unique1) FROM tenk1 t1,
6666
LATERAL (SELECT t2.unique1 FROM tenk1 t2
67-
WHERE t1.twenty = t2.unique1 ORDER BY 1) t2
67+
WHERE t1.twenty = t2.unique1 OFFSET 0) t2
6868
WHERE t1.unique1 < 1000;', false);
6969
explain_memoize
7070
-------------------------------------------------------------------------------------------
@@ -85,7 +85,7 @@ WHERE t1.unique1 < 1000;', false);
8585
-- And check we get the expected results.
8686
SELECT COUNT(*),AVG(t2.unique1) FROM tenk1 t1,
8787
LATERAL (SELECT t2.unique1 FROM tenk1 t2
88-
WHERE t1.twenty = t2.unique1 ORDER BY 1) t2
88+
WHERE t1.twenty = t2.unique1 OFFSET 0) t2
8989
WHERE t1.unique1 < 1000;
9090
count | avg
9191
-------+--------------------

src/test/regress/sql/memoize.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ WHERE t2.unique1 < 1000;
4848
SELECT explain_memoize('
4949
SELECT COUNT(*),AVG(t2.unique1) FROM tenk1 t1,
5050
LATERAL (SELECT t2.unique1 FROM tenk1 t2
51-
WHERE t1.twenty = t2.unique1 ORDER BY 1) t2
51+
WHERE t1.twenty = t2.unique1 OFFSET 0) t2
5252
WHERE t1.unique1 < 1000;', false);
5353

5454
-- And check we get the expected results.
5555
SELECT COUNT(*),AVG(t2.unique1) FROM tenk1 t1,
5656
LATERAL (SELECT t2.unique1 FROM tenk1 t2
57-
WHERE t1.twenty = t2.unique1 ORDER BY 1) t2
57+
WHERE t1.twenty = t2.unique1 OFFSET 0) t2
5858
WHERE t1.unique1 < 1000;
5959

6060
-- Reduce work_mem and hash_mem_multiplier so that we see some cache evictions

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy