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

with recursive clause not supported #100

Closed
qiqingli opened this issue Dec 24, 2024 · 2 comments
Closed

with recursive clause not supported #100

qiqingli opened this issue Dec 24, 2024 · 2 comments

Comments

@qiqingli
Copy link

qiqingli commented Dec 24, 2024

with recursive 
standard_address as (
        select id, parent_id,
            grade
        from pb_standard_addr
        where
            id = :addressId::numeric
        union
        select e.id, e.parent_id,
            e.grade
        from
            pb_standard_addr e
        inner join standard_address s on s.parent_id = e.id
    )
select * from standard_address;
["ERROR" - 4:50:23 PM] Error formatting document.
["ERROR" - 4:50:23 PM] Syntax Error: Unexpected "standard_address"
Was expecting to see: "(", "AS", or whitespace
  |
2 | standard_address as (
  | ^
Error: Syntax Error: Unexpected "standard_address"
Was expecting to see: "(", "AS", or whitespace
  |
2 | standard_address as (
  | ^
    at parse (/Users/qiqingli/node_modules/sql-parser-cst/lib/main.js:40:19)
    at Object.parse (/Users/qiqingli/node_modules/prettier-plugin-sql-cst/dist/index.js:41:76)
    at parse5 (file:///Users/qiqingli/node_modules/prettier/index.mjs:19838:24)
    at async coreFormat (file:///Users/qiqingli/node_modules/prettier/index.mjs:20386:25)
    at async formatWithCursor (file:///Users/qiqingli/node_modules/prettier/index.mjs:20598:14)
    at async Module.format2 (file:///Users/qiqingli/node_modules/prettier/index.mjs:22002:25)
["INFO" - 4:50:23 PM] Formatting completed in 328ms.
@nene
Copy link
Owner

nene commented Dec 24, 2024

Thanks for reporting.

Looks like some keywords are mistakenly not treated as case-insensitive. The above works fine when using uppercase RECURSIVE, but not with lowercase recursive.

@nene nene closed this as completed in d9727a9 Dec 24, 2024
@nene
Copy link
Owner

nene commented Dec 24, 2024

Fixed in 0.31.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants