mtxr/vscode-sqltools

Do you want to work on this issue?

You can request for a bounty in order to promote it!

:bug: Split space formatter creates invalid syntax for Postgres escaped string literals `E'This is a comment'` erroneously corrects to `E 'This is a comment'`` which is no longer parseable #680

slimlime posted onGitHub

Describe the bug Formatter creates invalid syntax for Postgres escaped string literals E'This is a comment' erroneously corrects to `E 'This is a comment'`` which is invalid syntax; no longer parseable. Results in error when attempting to run the formatted .sql.

I didn't see a workaround or setting for this postgres-specific syntax. Currently using bulk replace-all on sql files after linting. E ' -> E' may not be reliable.

<!-- Try to get more info on taking a look on the results window to see what's going on using the command Developer: Open webview developer tools and also trying on SQLTools: Show output channel logs. -->

To Reproduce Steps to reproduce the behavior: As above, type an escaped string literal E'somestring' and run the formatter to see it become invalid postgres syntax E 'someinvalidstring'

Expected behavior Escaped string literals in postgres syntax should not be split with a whitespace E'this is a valid escaped string literal'

not: E 'this is an invalid escaped string literal'

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • SQLTools Version [v0.22.11]

    • Also on previous versions this past year I had been working around until googling the repo to submit an issue. This may have been missed or I am missing a postgres-specific option flag somewhere?
  • VSCode Version: [1.47.3]

  • OS: [Windows, Linux] . Likely Mac as well

  • Driver:

    • PostgreSQL/Redshift
    • MySQL/MariaDB
    • MSSQL/Azure
    • SQLite
    • Other? Which...
  • Database version: [e.g. MySQL v5.6, PostgreSQL vX...]

  • Postgres 12.x (not sure if relevant)

Additional context Add any other context about the problem here.


Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests