Information functions

更新时间:
复制 MD 格式

Information functions return dynamic database information such as the current user, connection ID, and database version. PolarDB-X supports most standard MySQL information functions, with one exception noted below.

Supported functions

PolarDB-X supports the following information functions.

FunctionDescription
CONNECTION_ID()Returns the unique ID of the current connection.
CURRENT_USER(), CURRENT_USERReturns the details of the user who calls the function.
DATABASE()Returns the name of the current database.
LAST_INSERT_ID()Returns the value generated for an auto-increment primary key by the most recent INSERT statement.
SCHEMA()Returns the name of the current database. Equivalent to DATABASE().
SESSION_USER()Returns the details of the user who calls the function. Equivalent to USER().
SYSTEM_USER()Returns the details of the user who calls the function. Equivalent to USER().
USER()Returns the details of the user who calls the function.
VERSION()Returns the database version string.
BENCHMARK()Executes an expression repeatedly for performance testing.
CHARSET()Returns the character set name of a string argument.
COLLATION()Returns the collation of a string argument.
FOUND_ROWS()Returns the number of rows in the result set by the last SQL statement.
ROW_COUNT()Returns the number of rows that are affected by the last SQL statement.

Unsupported functions

The following information function is not supported by PolarDB-X. It is available in MySQL 5.7.

FunctionDescription
COERCIBILITY()Returns the collation coercibility value of a string argument.