cashapp / sqldelight

SQLDelight - Generates typesafe Kotlin APIs from SQL
https://cashapp.github.io/sqldelight/
Apache License 2.0
6.05k stars 502 forks source link

'WITH RECURSIVE' - "'WITH' unexpected" #3892

Open chrispytoes opened 1 year ago

chrispytoes commented 1 year ago

SQLDelight Version

2.0.0-alpha05

Operating System

Windows 10

Gradle Version

7.4.2

Kotlin Version

1.8

Dialect

SQLite

AGP Version

No response

Describe the Bug

I am using Intellij plugin, and I'm trying to write a WITH RECURSIVE query but it's saying 'WITH' unexpected. Building despite the error throws the same thing so I don't think it's just the plugin checking it wrong.

CREATE TABLE itemCategories (
    id INTEGER PRIMARY KEY NOT NULL,
    name TEXT NOT NULL,
    description TEXT NOT NULL,
    parent_id INTEGER
);

getTree {
    WITH RECURSIVE tree(id, name, description, parent_id, path) AS (
        SELECT id, name, description, parent_id, ARRAY[id]
        FROM itemCategories
        WHERE parent_id IS NULL
        UNION ALL
        SELECT c.id, c.name, c.description, c.parent_id, path || c.id
        FROM itemCategories c
        INNER JOIN tree t ON c.parent_id = t.id
    );
    SELECT * FROM tree;
}

I saw other issues mentioning WITH RECURSIVE, so I assume it's supported but is it? It doesn't throw any other syntax errors and gives full highlighting for the statement.

Stacktrace

No response

Gradle Build Script

No response

chrispytoes commented 1 year ago

I figured out how to set my dialect version, and it works now.

chrispytoes commented 1 year ago

It builds, however the Intellij editor still shows a syntax error for it.