Skip to content

fix: allow VALUES clause in CTEs in SQLite #5

Merged
sgress454 merged 1 commit intomasterfrom
sgress454/fix-cte-union-and-values
Jan 27, 2026
Merged

fix: allow VALUES clause in CTEs in SQLite #5
sgress454 merged 1 commit intomasterfrom
sgress454/fix-cte-union-and-values

Conversation

@sgress454
Copy link
Copy Markdown
Owner

for fleetdm/fleet#34635

This PR adds support for VALUES inside of common table expressions (CTEs) in SQLite. A unit test is added that includes both VALUES and for UNION clauses inside a CTE, since the fix involves updating the union_stmt rule.

Note that the union_stmt rule seems to be more referring to compound statements in general (which include UNION, UNION ALL, INTERSECT and EXCEPT) rather than just UNION, but renaming that is much higher touch so I just updated it in place.

@sgress454 sgress454 merged commit 6ae0620 into master Jan 27, 2026
sgress454 added a commit that referenced this pull request Jan 27, 2026
sgress454 added a commit to fleetdm/fleet that referenced this pull request Jan 28, 2026
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #34635

# Details

This PR switches us to a [fork of
node-sql-parser](https://github.com/sgress454/node-sql-parser) that I'm
maintaining to fast-track fixes to the SQLite implementation. The first
published version of the fork is 5.4.0-fork.1 (forked from v5.4.0 of the
upstream), and includes fixes for #34635 and #30109 that haven't made it
to the upstream yet.

Fixes in 5.4.0-fork.1:

* sgress454/node-sql-parser#7
* sgress454/node-sql-parser#5
* sgress454/node-sql-parser#4

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [X] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

## Testing

- [X] Added/updated automated tests
- Granular tests are added [in the package
itself](https://github.com/sgress454/node-sql-parser/blob/5.4.0-fork.1/test/sqlite.spec.js),
and new regression tests for the Fleet issues are added in the Fleet.
- [X] QA'd all new/changed functionality manually
 - Pasted the offending queries into the editor and saw no syntax errors
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

Successfully merging this pull request may close these issues.

1 participant