-
Notifications
You must be signed in to change notification settings - Fork 429
Closed
Labels
Description
Input data
Which SQL and options did you provide as input?
CREATE DATABASE IF NOT EXISTS sample;
USE sample;
sql-formatter -l mysql
Expected Output
CREATE DATABASE
IF NOT EXISTS sample;
USE sample;
Actual Output
CREATE DATABASE
IF NOT EXISTS sample;
USE
sample;
Why?
The current formatting result causes syntax error on MySQL 8.0.30.
It seems should not place \n
between USE
and <DB NAME>
.
$ mysql --version
mysql Ver 8.0.30 for Linux on x86_64 (MySQL Community Server - GPL)
$ cat test.sql
CREATE DATABASE
IF NOT EXISTS sample;
USE
sample;
$ mysql < test.sql
ERROR at line 4: USE must be followed by a database name
ERROR 1064 (42000) at line 5: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sample' at line 1
Usage
- How are you calling / using the library?
cat test.sql | sql-formatter -l mysql
- What SQL language(s) does this apply to?
mysql
- Which SQL Formatter version are you using?
10.6.0