Skip to content

Conversation

@Sea-n
Copy link

@Sea-n Sea-n commented Jan 21, 2026

Summary

  • Treat -> and ->> as SQL operators in the lexer.
  • Prevent formatter from inserting spaces around JSON path operators.
  • Add formatter test for JSON path access.

For example: SELECT details->'$."first_name"' FROM users;

Expected:

SELECT
    details->'$."first_name"'
FROM
    users;

Actual:

SELECT
    details - > '$."first_name"'
FROM
    users;

Caused SQL syntax error.

Tests

./vendor/bin/phpunit passed

I didn’t run ./vendor/bin/phpcbf as suggested in CONTRIBUTING.md because it currently changes about 60 files and produces roughly 150 lines of diff. If you’re okay with it, I’d love to handle that in a separate PR.

References

@Sea-n
Copy link
Author

Sea-n commented Jan 21, 2026

CC @MauricioFauth and @williamdes,
if you have a chance to review, I'd really appreciate it. Thanks!

- Treat `->` and `->>` as SQL operators in the lexer.
- Prevent formatter from inserting spaces around JSON path operators.
- Add formatter test for JSON path access.

For example:

```sql
SELECT
    details->'$."first_name"'
FROM
    users;
```

Signed-off-by: Sean Wei <[email protected]>
Copy link
Member

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay, thank you for adding a test
I will wait for another review from anyone else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants