CTE does not honor quoted columns name in recursive definition
Issue #2512
resolved
Probably the title didn't make any sense :) so let's give a try now: tested with 0.7.8, if a have a column that requires quoting due to being a reserved word (e.g. "order"), the column is not quoted in the CET recursive definition (the ''with recursive anon_1(...)'' part) and therefore the sql is invalid and cannot be executed.
Using the CTE example from the doc (and replacing ''quantity'' with ''order'') this is the produced output:
print(statement)
WITH RECURSIVE anon_1(sub_part, part, order) AS
(SELECT parts.sub_part AS sub_part, parts.part AS part, parts."order" AS "order"
FROM parts
WHERE parts.part = :part_1 UNION ALL SELECT parts_1.part AS part, parts_1.sub_part AS sub_part, parts_1."order" AS "order"
FROM parts AS parts_1, anon_1 AS anon_2
WHERE parts_1.part = anon_2.sub_part)
SELECT anon_1.sub_part, sum(anon_1."order") AS total_quantity
FROM anon_1 JOIN parts ON anon_1.part = parts.part GROUP BY anon_1.sub_part
As you can see order is quoted everywhere except in the first line.
Comments (3)
-
repo owner -
repo owner - changed status to resolved
-
repo owner - removed milestone
Removing milestone: 0.7.9 (automated comment)
- Log in to comment
should be easy.