Toad World® Forums

Picklist for CTEs, subqueries

You already do an incredible job at suggesting code, but the following examples do not work yet (not sure if CTEs were planned at all):

WITH cte AS (
SELECT 1 AS x FROM dual
)
SELECT cte.|
FROM cte
;

SELECT d1.dummy
FROM dual d1
LEFT JOIN (
SELECT dummy, COUNT(*) AS cnt – works when removing COUNT column
FROM dual
GROUP BY dummy
) d2 ON ( d2|

Your second example is fixed for next beta. I’ll log your common table expression example. Ideally it should work, but there’s nothing in there for it at the moment. It’s looking for “cte” in your sample as if it were an actual object.

The common table expression example is fixed in next beta. There is still a little work to do here as it should suggest CTE as a table when you’re in the FROM clause if it’s not present yet, but fields of CTE are recommended in the SELECT clause if CTE is in the FROM clause.

Michael

Great, that should cover most cases.

Out of curiosity I tried the following example with two CTEs and it did not work as expected.
Guess that’s low priority, just wanted to let you know in case this was easy to fix.

WITH cte AS
(
SELECT dual.dummy AS x FROM dual
),
cte2 AS
(
SELECT cte.x FROM cte – here
)
SELECT cte2.x – here
FROM cte2;

Thanks, I’ve logged this.