-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-32906: The SQL error plugin prints (null) as database if the mar…
…iadb 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.
- Loading branch information
1 parent
90cd712
commit ee7cc0a
Showing
6 changed files
with
104 additions
and
34 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
mysql-test/suite/plugins/t/mdev_27087.opt → ...te/plugins/t/sql_error_log_withdbinfo.opt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
--plugin-load-add=$SQL_ERRLOG_SO --sql-error-log-with-db-and-thread-info=1 | ||
--plugin-load-add=$SQL_ERRLOG_SO --sql-error-log-with-db-and-thread-info=1 --lower_case_table_names=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--source include/not_embedded.inc | ||
|
||
if (!$SQL_ERRLOG_SO) { | ||
skip No SQL_ERROR_LOG plugin; | ||
} | ||
|
||
show variables like 'sql_error_log%'; | ||
set global sql_error_log_rate=1; | ||
|
||
let $MYSQLD_DATADIR= `SELECT @@datadir`; | ||
|
||
--echo # Trying to set the variable at runtime | ||
|
||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
SET sql_error_log_with_db_and_thread_info=OFF; | ||
|
||
--echo # | ||
--echo # Using test database from mtr | ||
--echo # | ||
|
||
--error ER_DB_DROP_EXISTS | ||
DROP DATABASE db; | ||
|
||
--echo # | ||
--echo # Using no database at all | ||
--echo # | ||
|
||
DROP DATABASE test; | ||
--error ER_DB_DROP_EXISTS | ||
DROP DATABASE db; | ||
|
||
--echo # | ||
--echo # Using database with name `NULL` | ||
--echo # | ||
CREATE DATABASE `NULL`; | ||
USE `NULL`; | ||
--error ER_DB_DROP_EXISTS | ||
DROP DATABASE db; | ||
|
||
|
||
--let SEARCH_FILE= $MYSQLD_DATADIR/sql_errors.log | ||
--let LINES_TO_READ=4 | ||
--replace_regex /[1-9]* `NULL` [1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [^E]*/THREAD_ID `NULL` TIME HOSTNAME / /[1-9]* `test` [1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [^E]*/THREAD_ID `test` TIME HOSTNAME / /[1-9]* NULL [1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [^E]*/THREAD_ID NULL TIME HOSTNAME / | ||
--source include/read_head.inc | ||
|
||
DROP DATABASE `NULL`; | ||
|
||
--echo # Reset | ||
CREATE DATABASE test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters