jackc / sqlfmt

SQL Formatter
Apache License 2.0
337 stars 24 forks source link

Backticks support? #6

Closed SchumacherFM closed 4 years ago

SchumacherFM commented 7 years ago

Thank you for this nice formatter! A pleasure to have it.

One minor suggestion: Currently this MySQL query fails to parse:

SELECT `tax_class`.* FROM `tax_class` WHERE (`tax_class`.`class_id`='3');
$ pbpaste | sqlfmt -u
2017/06/11 20:52:48 parse error: syntax error at character 73
Parse failed

Removing the backticks and it works.

Do you plan to support the backticks? 8-)

jackc commented 7 years ago

At the moment the parser is based on PostgreSQL syntax and PostgreSQL doesn't support backticks. I don't have any objection to supporting MySQL specific syntax as well, but I suspect it may be rather difficult.

dsifford commented 6 years ago

@jackc Could the fact that this project is strictly postgres only right now be clarified in the readme? Or make it clear that non-ISO standard sql stuff isn't supported (i.e., a large portion of regularly used MySQL things).

Just gave this a try and it blew up on even some of the most basic of MySQL files.

SchumacherFM commented 4 years ago

I'll close it as too long inactive.