Context Functions



This page provides reference information for the context-related functions in TiDB Cloud Lake. These functions return information about the current session, database, or system context.

Session Information Functions

FunctionDescriptionExample
CONNECTION_IDReturns the connection ID for the current connectionCONNECTION_ID() → 42
CURRENT_USERReturns the user name and host for the current connectionCURRENT_USER() → 'root'@'%'
LAST_QUERY_IDReturns the query ID of the last executed queryLAST_QUERY_ID() → '01890a5d-ac96-7cc6-8128-01d71ab8b93e'

Database Context Functions

FunctionDescriptionExample
CURRENT_CATALOGReturns the name of the current catalogCURRENT_CATALOG() → 'default'
DATABASEReturns the name of the current databaseDATABASE() → 'default'

System Information Functions

FunctionDescriptionExample
VERSIONReturns the current version of TiDB Cloud LakeVERSION() → 'LakeQuery v1.2.252-nightly-193ed56304'

Was this page helpful?