mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-32906: The SQL error plugin prints (null) as database if the mariadb
client is not using any database to execute the SQL. Analysis: When there is no database, the database string is NULL so (null) gets printed. Fix: Print NULL instead of (null) because when there is no database SELECT DATABASE() return NULL. SO NULL is more appropriate choice.
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
show variables like 'sql_error_log%';
|
||||
Variable_name Value
|
||||
sql_error_log_filename sql_errors.log
|
||||
sql_error_log_rate 1
|
||||
sql_error_log_rotate OFF
|
||||
sql_error_log_rotations 9
|
||||
sql_error_log_size_limit 1000000
|
||||
sql_error_log_with_db_and_thread_info ON
|
||||
set global sql_error_log_rate=1;
|
||||
select * from t_doesnt_exist;
|
||||
ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist
|
||||
THREAD_ID DATABASE_NAME TIME HOSTNAME ERROR 1146: Table 'test.t_doesnt_exist' doesn't exist : select * from t_doesnt_exist
|
37
mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result
Normal file
37
mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result
Normal file
@@ -0,0 +1,37 @@
|
||||
show variables like 'sql_error_log%';
|
||||
Variable_name Value
|
||||
sql_error_log_filename sql_errors.log
|
||||
sql_error_log_rate 1
|
||||
sql_error_log_rotate OFF
|
||||
sql_error_log_rotations 9
|
||||
sql_error_log_size_limit 1000000
|
||||
sql_error_log_with_db_and_thread_info ON
|
||||
set global sql_error_log_rate=1;
|
||||
# Trying to set the variable at runtime
|
||||
SET sql_error_log_with_db_and_thread_info=OFF;
|
||||
ERROR HY000: Variable 'sql_error_log_with_db_and_thread_info' is a read only variable
|
||||
#
|
||||
# Using test database from mtr
|
||||
#
|
||||
DROP DATABASE db;
|
||||
ERROR HY000: Can't drop database 'db'; database doesn't exist
|
||||
#
|
||||
# Using no database at all
|
||||
#
|
||||
DROP DATABASE test;
|
||||
DROP DATABASE db;
|
||||
ERROR HY000: Can't drop database 'db'; database doesn't exist
|
||||
#
|
||||
# Using database with name `NULL`
|
||||
#
|
||||
CREATE DATABASE `NULL`;
|
||||
USE `NULL`;
|
||||
DROP DATABASE db;
|
||||
ERROR HY000: Can't drop database 'db'; database doesn't exist
|
||||
THREAD_ID `test` TIME HOSTNAME ERROR 1238: Variable 'sql_error_log_with_db_and_thread_info' is a read only variable : SET sql_error_log_with_db_and_thread_info=OFF
|
||||
THREAD_ID `test` TIME HOSTNAME ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db
|
||||
THREAD_ID NULL TIME HOSTNAME ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db
|
||||
THREAD_ID `NULL` TIME HOSTNAME ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db
|
||||
DROP DATABASE `NULL`;
|
||||
# Reset
|
||||
CREATE DATABASE test;
|
Reference in New Issue
Block a user