Skip to content
This repository has been archived by the owner on Jul 6, 2022. It is now read-only.

[FORMATTING] Multi-character operators in PostgreSQL syntax are not recognized #54

Open
JenChampagne opened this issue Dec 8, 2021 · 5 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed vscode Related to the VSCode Extension

Comments

@JenChampagne
Copy link

Describe the bug

Multi-character operators in PostreSQL syntax are not recognized.

I prefer to have the denseOperators config set to false so that I can have nice spacing in my SQL for readability. Unfortunately with that configuration set, JSON and JSONB operators go from ->> to - > > which causes PostgreSQL to throw an error stating unexpected >.

More about those operators here: PostgreSQL Docs

Expected Output

Given the following SQL for PostgreSQL:

select
    id,
    data->>'name'
from
    table_with_jsonb_column
;

I expect to format as:

select
    id,
    data ->> 'name'
from
    table_with_jsonb_column
;

Actual Output

What is currently formatted as:

select
    id,
    data - > > 'name'
from
    table_with_jsonb_column
;

Usage

  • How are you calling / using the script? (Please provide a code snippet, if applicable)
  • What SQL language(s) does this apply to?
  • What Node version? (If applicable)

I am using this through the VS Code extension which uses ^5.0.0-beta.1 of this package. I tried to confirm that it was not an issue with the extension as best I could, but apologies if it turns out this is a bug with the extension and not this package.

I believe these operators are likely only for PostreSQL dialects of SQL.

Additional context
Add any other context about the problem here.

@JenChampagne JenChampagne added the bug Something isn't working label Dec 8, 2021
@JenChampagne JenChampagne changed the title [FORMATTING] Issue Title Here [FORMATTING] Multi-character operators in PostreSQL syntax are not recognized Dec 8, 2021
@inferrinizzard inferrinizzard self-assigned this Dec 8, 2021
@inferrinizzard
Copy link
Owner

Hi @JenChampagne , I believe this issue is resolved as of v5.0.0 but I will double check this before the next release (v5.1.0) + update the package dependency in the VSCode Extension.

Keeping this issue open for now.

@inferrinizzard
Copy link
Owner

Update: the issue here is regarding the language config in VSCode extension - currently all files are using sql as language, will be patched in upcoming release (v5.1.0)

@inferrinizzard
Copy link
Owner

inferrinizzard commented Dec 17, 2021

@JenChampagne Hi, I have a few additional questions for you:

@inferrinizzard inferrinizzard added the help wanted Extra attention is needed label Dec 22, 2021
@inferrinizzard
Copy link
Owner

VSCode SQL Flavour detection for the Microsoft PostgreSQL and MSSQL Extension is currently not publicly available for other extensions - info request here: microsoft/vscode-mssql#17182

Putting this on hold until I get an answer from the MSSQL repo maintainers (PGSQL repo is dead)

@inferrinizzard inferrinizzard added the vscode Related to the VSCode Extension label Dec 22, 2021
@inferrinizzard
Copy link
Owner

In the meantime, please use the workaround in #62

@inferrinizzard inferrinizzard changed the title [FORMATTING] Multi-character operators in PostreSQL syntax are not recognized [FORMATTING] Multi-character operators in PostgreSQL syntax are not recognized Apr 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed vscode Related to the VSCode Extension
Projects
None yet
Development

No branches or pull requests

2 participants