Reserved words
Which words Raft DB does not accept as an unquoted name, and how that differs from the long reserved lists of MySQL and MariaDB.
A reserved word is a word that cannot be used as a name unless it is quoted with backticks.
The words Raft DB refuses as unquoted names#
The parser refuses these 41 words where it looks for a name (a column, a table alias, a select item):
select from where group order limit having union join on set values
and or not as into inner left right for offset fetch using natural
when then else end cross straight_join use force ignore lock outer
except intersect window over returningQuote one of them to use it as a name:
CREATE TABLE p (id INT PRIMARY KEY, `order` INT, `from` INT, `to` INT);
SELECT p.order, p.from FROM p; -- after a dot any word is a nameRemarks#
- A shorter list than MySQL's. MySQL 8 reserves about 260 words (
ACCESSIBLE,ADD,ALL,ALTER, ...,ZEROFILL), MariaDB about the same with differences. Raft DB refuses an unquoted use only of the 41 words above, because its parser needs them to know where a clause ends. A name that MySQL would refuse (SELECT 1 AS rank, a column calledkey,descorindexin a place where no keyword is expected) may be accepted by Raft DB. To write SQL that also runs on a real MySQL or MariaDB server, quote every name that is on the server's reserved list; see the lists in the MySQL manual and the MariaDB manual. - Non-reserved words (
STATUS,COMMENT,DATE,TIME,TEXT,YEARand so on) are always usable as names. - After a dot any word is a name (
t.group,p.order). - Function names are not reserved.
LEFT,RIGHTandVALUEScan be function names when a(follows. - Statement words such as
SHOW,DESCRIBEorCALLare read only at the start of a statement. - Words for the connector. Names that start with
__rdb_,__tmpor__u_are reserved for the front-end's own tables: see Identifiers. - Words that MariaDB adds to the reserved list in newer versions (
OFFSET,FETCH,RETURNING,INTERSECT,EXCEPT,WINDOW) are in the list above for both dialects.