SQL reference (MySQL and MariaDB dialects)

Statements not supported yet

The statements and clauses that the Raft DB front-ends refuse today with error 1235 or 1064, and how to tell the two apart.

Raft DB does not run every statement of MySQL and MariaDB. This page lists what is refused today. The list is made from the parser (every place that refuses a statement as unsupported), the executors, and the decision records (D54 to D88). The coverage runs of the MySQL and MariaDB manuals are made by running the examples of the manuals against a real MySQL or MariaDB and Raft DB; they were generated before the later steps (views D70, routines D87, triggers D88 and others), so they still show statements as unsupported that work now. The code wins: when a source disagrees with the parser, trust the parser.

Two kinds of refusal#

ErrorMeaningText
1235 (42000)The statement is valid MySQL or MariaDB, and this version does not do it yet. It is refused rather than guessed.This version of the Raft DB MySQL front-end doesn't yet support '<what>'
1064 (42000)The text is not valid for the parser: a syntax error, or a statement whose first word the parser does not know. The message gives the position.Syntax error in the SQL statement; ...

A statement refused with 1235 changes nothing.

Refused with error 1235#

Queries#

  • SELECT ... INTO OUTFILE and INTO DUMPFILE write nothing: error 1290.
  • FETCH FIRST ... WITH TIES (MariaDB).
  • Window frames in GROUPS mode.
  • DISTINCT inside an ordinary function call; an aggregate over several expressions (except GROUP_CONCAT).
  • Parenthesised joins (FROM (a JOIN b ON ...)).
  • LIKE ... ESCAPE; COLLATE to a binary or case-sensitive collation.
  • ORDER BY or LIMIT after a VALUES list.
  • A function called inside a routine with a column of the row as an argument.

Data definition#

  • CREATE TABLE: FULLTEXT and SPATIAL indexes, partitioning, REFERENCES inside a column definition, ON UPDATE as a column attribute.
  • ALTER TABLE: ADD FULLTEXT, ADD SPATIAL, partition changes, adding an AUTO_INCREMENT or PRIMARY KEY column, dropping or retyping a column of a unique key, renaming a unique key, changing AUTO_INCREMENT or PRIMARY KEY through MODIFY, moving a table to another database, a primary key change when the table has unique keys, adding an expression-default column or a NOT NULL date, time or JSON column without default to a table that has rows, ALTER CHECK, and any change not in the grammar.
  • RENAME TABLE (use ALTER TABLE ... RENAME TO; RENAME USER works).
  • ALTER DATABASE, ALTER PROCEDURE, ALTER FUNCTION, ALTER EVENT, ALTER INSTANCE, ALTER SERVER, ALTER TABLESPACE.
  • CREATE EVENT, CREATE ROLE, CREATE TABLESPACE, CREATE SERVER, CREATE LOGFILE GROUP, CREATE SPATIAL REFERENCE SYSTEM, CREATE RESOURCE GROUP, CREATE FULLTEXT INDEX, CREATE SPATIAL INDEX.
  • DROP EVENT, DROP ROLE, DROP TABLESPACE, DROP SERVER, DROP LOGFILE GROUP, DROP SPATIAL REFERENCE SYSTEM, DROP RESOURCE GROUP.

Accounts and variables#

  • Roles: GRANT role TO user, proxy grants.
  • GRANT and REVOKE on routines (ON PROCEDURE, ON FUNCTION).
  • IDENTIFIED BY RANDOM PASSWORD.
  • Account options other than ACCOUNT UNLOCK and REQUIRE NONE: REQUIRE SSL, PASSWORD EXPIRE, ACCOUNT LOCK, resource limits and the others.
  • SET PERSIST, SET PERSIST_ONLY.

Administration and other#

  • LOAD DATA, LOAD XML, LOAD INDEX; KILL.
  • ANALYZE and OPTIMIZE without the word TABLE (MariaDB ANALYZE SELECT, ANALYZE FORMAT=JSON).
  • EXPLAIN ANALYZE; EXPLAIN FORMAT other than TRADITIONAL; EXPLAIN of a statement other than SELECT, UNION, INSERT, UPDATE, DELETE.
  • Every SHOW not in the list: SHOW MASTER STATUS, SHOW SLAVE STATUS, SHOW REPLICA STATUS, SHOW BINARY LOGS, SHOW BINLOG EVENTS, SHOW ENGINE ... STATUS, SHOW PRIVILEGES, SHOW CREATE USER, SHOW CREATE EVENT, SHOW PROFILE, SHOW PROFILES.
  • Cursors on prepared statements (COM_STMT_FETCH).
  • SQL SECURITY INVOKER rights checks; Oracle-style packages and %TYPE.

Refused with error 1064 (the parser does not know the statement or the clause)#

The parser knows the first word of the statements listed in this chapter. A statement that starts with any other word is a syntax error ("unknown statement"). In particular:

  • HANDLER, XA (distributed transactions), HELP, CHECKSUM TABLE, CACHE INDEX, BINLOG.
  • Replication and group replication control: CHANGE REPLICATION SOURCE TO, CHANGE MASTER TO, START REPLICA / START SLAVE, STOP REPLICA / STOP SLAVE, START GROUP_REPLICATION, RESET, PURGE BINARY LOGS.
  • Plugin and server control: INSTALL PLUGIN, UNINSTALL PLUGIN, INSTALL COMPONENT, CLONE, IMPORT TABLE, SHUTDOWN, RESTART.
  • SIGNAL, RESIGNAL and GET DIAGNOSTICS outside a stored routine or trigger body (inside, they work).
  • CHECK and REPAIR without the word TABLE.
  • SET ROLE, SET DEFAULT ROLE, SET RESOURCE GROUP, SET STATEMENT ... FOR (MariaDB).
  • Clauses the grammar of a statement does not have: INSERT LOW_PRIORITY | HIGH_PRIORITY | DELAYED, INSERT ... PARTITION (...), INSERT ... AS alias, UPDATE/DELETE ... LIMIT offset, count, SELECT ... FETCH in the MySQL dialect, VALUES (...) without ROW in the MySQL dialect and VALUES ROW(...) in the MariaDB dialect.

Accepted but without effect#

These are not refused, but they do not do what MySQL does:

  • FOR UPDATE, FOR SHARE, LOCK IN SHARE MODE, LOCK TABLES, LOCK INSTANCE: nothing is locked.
  • FLUSH ...: nothing to flush.
  • ENGINE=, CHARSET=, COLLATE, ROW_FORMAT= and other table, database and column options; ZEROFILL; index hints; USING BTREE.
  • SET TRANSACTION ISOLATION LEVEL ...: the level is always read uncommitted.
  • WITH CHECK OPTION on views: stored, not enforced.
  • INVISIBLE indexes: kept and used by reads.
  • SHOW STATUS, SHOW ENGINES, SHOW EVENTS: fixed or empty answers.
  • ANALYZE, OPTIMIZE, CHECK, REPAIR TABLE: answer as a healthy InnoDB table.
  • Privileges EXECUTE, CREATE ROUTINE, ALTER ROUTINE, TRIGGER, EVENT: can be granted, not enforced.

See also#