-
Notifications
You must be signed in to change notification settings - Fork 0
Description
In MySQL and PostgreSQL (at least), reserved words may be used if quoted. For instance in MariaDB 10.3:
> CREATE DATABASE database;
ERROR 1064 (42000): You have an error in your SQL syntax;
check the manual that corresponds to your MariaDB server
version for the right syntax to use near 'database' at line 1
> CREATE DATABASE `database`;
Query OK, 1 row affected (0,000 sec)
I don't know if everby DBMS aggrees to use reserved words as identifiers if quoted, but if we know the dialect specifically used at runtime, we may quote accordingly even reserved words and not throw an exception. If some reserved words are unquotable by some supported DBMS, it must throw an exception at compile time (i.e. unconditionally throw a LogicException, which should be detected by the developer testing their code/PHPUnit/etc).
Also, it may not be desirable to allow reserved words as identifiers at compile time for hardening reasons, and some softwares may prefer not to allow them to add strictness (but some softwares may want to allow a subset of them for legacy reasons, and at the same time prevent the use of most reserved words to reduce the attack surface). In this sense, this is linked to #1 which proposes to add a configuration parameter about the supported DBMS dialects at compile time.