sql-formatter-org / sql-formatter-org/sql-formatter

Problem with unicode quotes in Transact-SQL

Open
#942 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
2.9k
Forks
456
Avg merge
3d 4h
Merged PRs (30d)
3

Description

Describe the bug
An Unexpected Error Occurred
Parse error: Unexpected "​'@p0​' an" at line 5 column 4. SQL dialect used: "transactsql".

Please report this at Github issues page.

Stack Trace:

Error: Parse error: Unexpected "​'@p0​' an" at line 5 column 4.
SQL dialect used: "transactsql".
at T.default.createParseError (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:278047)
at T.default.tokenize (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:277813)
at T.default.tokenize (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:272790)
at T.default.tokenize (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:287994)
at T.default.reset (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:286521)
at T.S.feed (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:312761)
at Object.parse (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:288132)
at T.default.parse (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:16545)
at T.default.format (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:16443)
at T.formatDialect (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:307558)

format the SQL text

Actual behavior
What happened instead?

Usage
used: https://sql-formatter-org.github.io/sql-formatter/
used transact-SQL

My input text

select 
top @p1 ltrim(rtrim(long_matt_name)) 
from sl_hbm_matter where matter_uno = @p2 and
 CONVERT(DATETIME,CONVERT(VARCHAR(@p3), last_modified)) 
<= ​'@p0​' and CONVERT(DATETIME,CONVERT(VARCHAR(@p3), sl_entry_date))
 >= ​'@p0​' order by sl_entry_date desc

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure in the SQL Formatter web interface using the supplied query and the transactsql dialect. Start by tracing the tokenize, parse, and formatDialect entry points named in the stack trace; done means this input formats successfully without the unexpected-token error, with regression coverage if the existing test structure is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
54/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.