GET DIAGNOSTICS

GET DIAGNOSTICS 语句获取 TiDB Server 的诊断空间信息。

语法图

GetDiagnosticsStmt
GETdiagnosticsStatusDIAGNOSTICSstatementInformationItemsCONDITIONconditionNumberconditionInformationItems
diagnosticsStatus
CURRENTSTACKED
statementInformationItems
statementInformationItemstatementInformationItemstatementInformationItems
statementInformationItem
target=statementInformationItemName
conditionInformationItems
conditionInformationItemconditionInformationItemconditionInformationItems
conditionInformationItem
target=conditionInformationItemName
statementInformationItemName
NUMBERROW_COUNT
conditionInformationItemName
CLASS_ORIGINSUBCLASS_ORIGINRETURNED_SQLSTATEMESSAGE_TEXTMYSQL_ERRNOCONSTRAINT_CATALOGCONSTRAINT_SCHEMACONSTRAINT_NAMECATALOG_NAMESCHEMA_NAMETABLE_NAMECOLUMN_NAMECURSOR_NAME

示例

signal SQLSTATE '02000' set MESSAGE_TEXT= 'xwsfq', MYSQL_ERRNO = 1234 ,COLUMN_NAME = 'xswasz',CONSTRAINT_NAME = 'xxxsas',CLASS_ORIGIN = 'xxxxx',SUBCLASS_ORIGIN= 'xxxxx', CONSTRAINT_CATALOG='xzzasa',CONSTRAINT_SCHEMA='xxxzsaa',CATALOG_NAME='xxzsaa',SCHEMA_NAME='xZas',TABLE_NAME='xZsa',CURSOR_NAME='xazass' signal SQLSTATE '02000' set MESSAGE_TEXT= 'xwsfq', MYSQL_ERRNO = 1234 ,COLUMN_NAME = 'xswasz',CONSTRAINT_NAME = 'xxxsas',CLASS_ORIGIN = 'xxxxx',SUBCLASS_ORIGIN= 'xxxxx', CONSTRAINT_CATALOG='xzzasa',CONSTRAINT_SCHEMA='xxxzsaa',CATALOG_NAME='xxzsaa',SCHEMA_NAME='xZas',TABLE_NAME='xZsa',CURSOR_NAME='xazass'; ERROR 1234 (02000): xwsfq get Diagnostics CONDITION 1 @a1 = CLASS_ORIGIN ,@b1 = SUBCLASS_ORIGIN,@c1 =MYSQL_ERRNO, @d1= MESSAGE_TEXT,@e1 = RETURNED_SQLSTATE; select @a1,@b1,@c1,@d1,@e1; +-------+-------+------+-------+-------+ | @a1 | @b1 | @c1 | @d1 | @e1 | +-------+-------+------+-------+-------+ | xxxxx | xxxxx | 1234 | xwsfq | 02000 | +-------+-------+------+-------+-------+ 1 row in set (0.00 sec) select CAST('6x' as unsigned integer),CAST('6x' as unsigned integer),CAST('6x' as unsigned integer); +--------------------------------+--------------------------------+--------------------------------+ | CAST('6x' as unsigned integer) | CAST('6x' as unsigned integer) | CAST('6x' as unsigned integer) | +--------------------------------+--------------------------------+--------------------------------+ | 6 | 6 | 6 | +--------------------------------+--------------------------------+--------------------------------+ 1 row in set, 3 warnings (0.01 sec) get Diagnostics CONDITION 1 @a = CLASS_ORIGIN ,@b = SUBCLASS_ORIGIN,@c =MYSQL_ERRNO, @d= MESSAGE_TEXT,@e = RETURNED_SQLSTATE; get Diagnostics CONDITION 2 @a1 = CLASS_ORIGIN ,@b1 = SUBCLASS_ORIGIN,@c1 =MYSQL_ERRNO, @d1= MESSAGE_TEXT,@e1 = RETURNED_SQLSTATE; get Diagnostics CONDITION 3 @a2 = CLASS_ORIGIN ,@b2 = SUBCLASS_ORIGIN,@c2 =MYSQL_ERRNO, @d2= MESSAGE_TEXT,@e2 = RETURNED_SQLSTATE; select @a,@b,@c,@d,@e; +----------+----------+------+-----------------------------------------+-------+ | @a | @b | @c | @d | @e | +----------+----------+------+-----------------------------------------+-------+ | ISO 9075 | ISO 9075 | 1292 | Truncated incorrect INTEGER value: '6x' | 22007 | +----------+----------+------+-----------------------------------------+-------+ 1 row in set (0.00 sec) select @a1,@b1,@c1,@d1,@e1; +----------+----------+------+-----------------------------------------+-------+ | @a1 | @b1 | @c1 | @d1 | @e1 | +----------+----------+------+-----------------------------------------+-------+ | ISO 9075 | ISO 9075 | 1292 | Truncated incorrect INTEGER value: '6x' | 22007 | +----------+----------+------+-----------------------------------------+-------+ 1 row in set (0.00 sec) select @a2,@b2,@c2,@d2,@e2; +----------+----------+------+-----------------------------------------+-------+ | @a2 | @b2 | @c2 | @d2 | @e2 | +----------+----------+------+-----------------------------------------+-------+ | ISO 9075 | ISO 9075 | 1292 | Truncated incorrect INTEGER value: '6x' | 22007 | +----------+----------+------+-----------------------------------------+-------+ 1 row in set (0.00 sec)

MySQL 兼容性

兼容 MySQL 语法以及功能。

另请参阅