You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Certain special Postgres JSON operators (such as @>) aren't handled by the sqltools formatter and cause the query to become invalid, for example:
SELECT json_col
FROM (
SELECT'[{"a":"foo"},{"b":"bar"},{"c":"baz"}]' :: jsonb json_col
) AS tbl
WHERE json_col @>'[{"c":"baz"}]';
is transformed to the below when formatted (space added between @ & >):
SELECT json_col
FROM (
SELECT'[{"a":"foo"},{"b":"bar"},{"c":"baz"}]' :: jsonb json_col
) AS tbl
WHERE json_col @ >'[{"c":"baz"}]';
To Reproduce
Steps to reproduce the behavior:
Open a new sql file and paste the following query:
SELECT json_col
FROM (
SELECT'[{"a":"foo"},{"b":"bar"},{"c":"baz"}]' :: jsonb json_col
) AS tbl
WHERE json_col @>'[{"c":"baz"}]';
Format the document (or simply save if format on save is configured)
Attempting to execute the query will now result in an error: operator does not exist: jsonb @
Describe the bug
Certain special Postgres JSON operators (such as
@>
) aren't handled by the sqltools formatter and cause the query to become invalid, for example:is transformed to the below when formatted (space added between
@
&>
):To Reproduce
Steps to reproduce the behavior:
operator does not exist: jsonb @
Expected behavior
The document should be formatted as usual but any special JSON operators (https://www.postgresql.org/docs/current/functions-json.html) should remain valid, and not be split with a space.
Desktop:
The text was updated successfully, but these errors were encountered: