Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Formatter] Filtering sub-selects causes syntax error #147

Closed
ohaibbq opened this issue Jan 30, 2024 · 0 comments · Fixed by #157
Closed

[Formatter] Filtering sub-selects causes syntax error #147

ohaibbq opened this issue Jan 30, 2024 · 0 comments · Fixed by #157

Comments

@ohaibbq
Copy link
Contributor

ohaibbq commented Jan 30, 2024

WITH contributors AS (SELECT 'Dan' AS name, 3 AS tenure),
toks AS (
    SELECT name FROM (
        SELECT * FROM contributors
        WHERE name = 'Dan'
    ) sub
    WHERE tenure = 3
)
SELECT * FROM toks;

raises

failed to query ...: near "WHERE": syntax error
--- FAIL: TestQuery (0.02s)
    --- FAIL: TestQuery/syntax_error_test (0.01s)

Adjusting the query to not use a filter in the sub-select parses and runs successfully i.e.

WITH contributors AS (SELECT 'Dan' AS name, 3 AS tenure),
toks AS (
    SELECT name FROM (
        SELECT * FROM contributors
    ) sub
    WHERE tenure = 3
)
SELECT * FROM toks;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant