SHOW ERRORS

This statement shows errors from previously executed statements. The error buffer is cleared as soon as a statement executes successfully. In which case, SHOW ERRORS will return an empty set.

The behavior of which statements generate errors vs. warnings is highly influenced by the current sql_mode.

Synopsis

ShowErrorsStmt
SHOWERRORSShowLikeOrWhere
ShowLikeOrWhere
LIKESimpleExprWHEREExpression

Examples

mysql> select invalid; ERROR 1054 (42S22): Unknown column 'invalid' in 'field list' mysql> create invalid; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 14 near "invalid" mysql> SHOW ERRORS; +-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+ | Level | Code | Message | +-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+ | Error | 1054 | Unknown column 'invalid' in 'field list' | | Error | 1064 | You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 14 near "invalid" | +-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec) mysql> CREATE invalid2; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 15 near "invalid2" mysql> SELECT 1; +------+ | 1 | +------+ | 1 | +------+ 1 row in set (0.00 sec) mysql> SHOW ERRORS; Empty set (0.00 sec)

MySQL compatibility

The SHOW ERRORS statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also