ERROR: could not devise a query plan for the given query (UNIONS and LATERAL)
Elvis Pranskevichus <elprans@gmail.com>
From: Elvis Pranskevichus <elprans@gmail.com>
To: pgsql-bugs@postgresql.org
Date: 2018-01-23T18:10:59Z
Lists: pgsql-bugs
Hi,
The following (admittedly bizzare) query causes the error in the subject
on all recent versions of Postgres:
SELECT
"q2"."v"
FROM
LATERAL
(SELECT
"q11"."v"
FROM
(
(SELECT 2::bigint AS "v") UNION ALL
(SELECT 3::bigint AS "v")
) AS "q11"
) AS "q1"
CROSS JOIN LATERAL
(
(SELECT
"q3"."v"
FROM
(
(SELECT 4::bigint AS "v") UNION ALL
(SELECT 5::bigint AS "v")
) AS "q3"
)
UNION ALL
(SELECT "q1"."v")
) AS "q2"
ORDER BY
"q2"."v";
Interestingly, removing UNION from either "q3" or "q11", as well as
removing the ::bigint casts makes it work.
Elvis
Commits
-
Teach reparameterize_path() to handle AppendPaths.
- b100a5274ffa 9.3.21 landed
- ae3699a6ae55 9.6.7 landed
- 8a2228b2f5dc 9.5.11 landed
- 54e1599c76df 9.4.16 landed
- c5e59bb602e5 10.2 landed
- bb94ce4d26c3 11.0 landed