xo / usql

Universal command-line interface for SQL databases
MIT License
8.96k stars 350 forks source link

double quotes can't be supported in mysql driver #316

Closed mrpre closed 2 years ago

mrpre commented 2 years ago

only single quote can be recognized in usql

my:root@server.com:3306/mydb=> update `version_release` set `db_type` = 'Redis';
UPDATE
my:root@server.com:3306/mydb=> update `version_release` set `db_type` = "Redis";
error: mysql: 1054: Unknown column 'Redis' in 'field list'
my:root@server:3306/mydb=>

while I use mysql command

MySQL [mydb]> UPDATE version_release set db_type="Redis";
Query OK, 0 rows affected (0.03 sec)
Rows matched: 2  Changed: 0  Warnings: 0

MySQL [mydb]> UPDATE version_release set db_type='Redis';
Query OK, 0 rows affected (0.04 sec)
Rows matched: 2  Changed: 0  Warnings: 0

MySQL [mydb]>
kenshaw commented 2 years ago

There was a very clear, conscious decision when I was writing usql to force the ANSI SQL mode for MySQL. In my humble opinion, it is best practice to use the SQL standard single quotes for quoted strings, and to leave identifiers unquoted. Closing this, as this is "implemented as designed".