fix: set transaction variables not working in mysql protocol (#4912)

This commit is contained in:
dennis zhuang
2024-10-30 18:59:13 +08:00
committed by GitHub
parent fd8eba36a8
commit a34035a1f2
2 changed files with 22 additions and 0 deletions

View File

@@ -60,6 +60,8 @@ static OTHER_NOT_SUPPORTED_STMT: Lazy<RegexSet> = Lazy::new(|| {
"(?i)^(SET FOREIGN_KEY_CHECKS(.*))",
"(?i)^(SET AUTOCOMMIT(.*))",
"(?i)^(SET SQL_LOG_BIN(.*))",
"(?i)^(SET SESSION TRANSACTION(.*))",
"(?i)^(SET TRANSACTION(.*))",
"(?i)^(SET sql_mode(.*))",
"(?i)^(SET SQL_SELECT_LIMIT(.*))",
"(?i)^(SET @@(.*))",

View File

@@ -60,6 +60,7 @@ macro_rules! sql_tests {
$service,
test_mysql_auth,
test_mysql_stmts,
test_mysql_crud,
test_mysql_timezone,
test_mysql_async_timestamp,
@@ -133,6 +134,25 @@ pub async fn test_mysql_auth(store_type: StorageType) {
guard.remove_all().await;
}
pub async fn test_mysql_stmts(store_type: StorageType) {
common_telemetry::init_default_ut_logging();
let (addr, mut guard, fe_mysql_server) = setup_mysql_server(store_type, "sql_crud").await;
let mut conn = MySqlConnection::connect(&format!("mysql://{addr}/public"))
.await
.unwrap();
conn.execute("SET SESSION TRANSACTION READ ONLY")
.await
.unwrap();
conn.execute("SET TRANSACTION READ ONLY").await.unwrap();
let _ = fe_mysql_server.shutdown().await;
guard.remove_all().await;
}
pub async fn test_mysql_crud(store_type: StorageType) {
common_telemetry::init_default_ut_logging();