sql-formatter-org / sql-formatter

A whitespace formatter for different query languages
https://sql-formatter-org.github.io/sql-formatter/
MIT License
2.32k stars 398 forks source link

Unable to use "#" in table names #717

Closed progton1 closed 6 months ago

progton1 commented 7 months ago

Describe the bug I'm working in a database that has some connecting tables that are defined like this:

SOME_TABLE#SOMETHING The issue presents itself when the table has a pound sign in its name.

This causes the vscode plugin to generate the following error: Unable to format SQL: Error: Parse error: Unexpected "#SOMETHING" at line 2 column 16

Expected behavior That the plugin would format the SQL script

Actual behavior Recieved an error.

Usage

nene commented 7 months ago

First off, you seem to be using the "Prettier SQL VSCode" extension. This is no more maintained. See the FAQ.

I'm assuming this applies to most dialects.

Not quite. Rather the opposite is true. Most SQL dialects do not allow # characters in table names (or any identifier names). I don't know which dialect this is that you are using.

nene commented 6 months ago

Not enough info to do anything about this. So I'm closing this.