fix: Support string concatenation in LIKE expressions#2552
Merged
taozhi8833998 merged 2 commits intotaozhi8833998:masterfrom Sep 8, 2025
Merged
Conversation
3 tasks
sgress454
added a commit
to fleetdm/fleet
that referenced
this pull request
Aug 26, 2025
for #30854 # Details This PR updates our SQL query parser to allow string concatenation inside of LIKE expressions, e.g. ```sql SELECT * FROM file WHERE path LIKE 'C:' || CHAR(92) || 'Users' || CHAR(92) || 'example.txt'; ``` See https://github.com/sgress454/node-sql-parser/pull/1/files for the code changes in the parser, which are packaged into the changes in this PR using the instructions [here](https://github.com/fleetdm/fleet/blob/sgress454/30854-allow-concat-in-like/frontend/utilities/node-sql-parser/README.md#L12). PR to upstream package: taozhi8833998/node-sql-parser#2552 # 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 (in upstream repo) - [X] QA'd all new/changed functionality manually
taozhi8833998
approved these changes
Sep 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where a string concatenation in a LIKE expression fails to parse:
The fix is to swap the precedence of the
comparison_exprandliteralalternatives, so that the entire concatenation expression is parsed rather than just taking'C:'as a literal and then leaving|| CHAR(92) || 'Users' || CHAR(92) || 'example.txt';as an unparsable fragment.