WITH clause, CTE problem

Why would the below query include output from cached_a?

WITH cached_b AS (
    SELECT * from ([{"a":1, "b":2}, {"a":1, "b":2}]) AS A
),
cached_a AS (
    SELECT 3
)
SELECT * FROM cached_b

image

What version do you have? When I run that with 7.6.0 I get -

Screenshot 2024-03-22 at 8.58.28 AM

1 Like

It is an issue fixed in 7.6 (you probably won’t be able to view it) MB-52918 Before the issue was addressed all bindings (LET or WITH identifiers) were included in a blanket “*” (“everything”) expansion.

3 Likes

You can avoid it with:

SELECT cached_b FROM cached_b

instead of “*”. (Or of course cached_b.* etc.)

1 Like