From 73dfb402bfb58deaae06d4c5062b1de017e2d520 Mon Sep 17 00:00:00 2001 From: Rahul Anand Date: Mon, 2 Mar 2020 20:05:28 +0530 Subject: [PATCH] MDEV-20500: Bad error msg on disabling local infile --- mysql-test/suite/sys_vars/r/local_infile_func.result | 2 +- mysql-test/suite/sys_vars/t/local_infile_func.test | 2 +- sql/share/errmsg-utf8.txt | 5 ++++- sql/sql_parse.cc | 5 +++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/local_infile_func.result b/mysql-test/suite/sys_vars/r/local_infile_func.result index 1c116090f88..9b41f715d11 100644 --- a/mysql-test/suite/sys_vars/r/local_infile_func.result +++ b/mysql-test/suite/sys_vars/r/local_infile_func.result @@ -29,7 +29,7 @@ DROP TABLE IF EXISTS t1; create table t1(a int); LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1; -ERROR 42000: The used command is not allowed with this MariaDB version +ERROR HY000: The used command is not allowed because the MariaDB server or client has disabled the local infile capability SELECT count(*) from t1; count(*) 0 diff --git a/mysql-test/suite/sys_vars/t/local_infile_func.test b/mysql-test/suite/sys_vars/t/local_infile_func.test index 99bb9c65715..be26fb5bff9 100644 --- a/mysql-test/suite/sys_vars/t/local_infile_func.test +++ b/mysql-test/suite/sys_vars/t/local_infile_func.test @@ -74,7 +74,7 @@ DROP TABLE IF EXISTS t1; create table t1(a int); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---Error ER_NOT_ALLOWED_COMMAND +--Error ER_LOAD_INFILE_CAPABILITY_DISABLED eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 78b6cfa63c8..a57d4a178cb 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7944,4 +7944,7 @@ ER_WARN_HISTORY_ROW_START_TIME ER_PART_STARTS_BEYOND_INTERVAL eng "%`s: STARTS is later than query time, first history partition may exceed INTERVAL value" ER_GALERA_REPLICATION_NOT_SUPPORTED - eng "DDL-statement is forbidden as table storage engine does not support Galera replication" \ No newline at end of file + eng "DDL-statement is forbidden as table storage engine does not support Galera replication" +ER_LOAD_INFILE_CAPABILITY_DISABLED + eng "The used command is not allowed because the MariaDB server or client has disabled the local infile capability" + rum "Comanda folosită nu este permisă deoarece clientul sau serverul MariaDB a dezactivat această capabilitate" \ No newline at end of file diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index dac5b025821..470b5154c9c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4940,8 +4940,9 @@ mysql_execute_command(THD *thd) if (!(thd->client_capabilities & CLIENT_LOCAL_FILES) || !opt_local_infile) { - my_message(ER_NOT_ALLOWED_COMMAND, ER_THD(thd, ER_NOT_ALLOWED_COMMAND), MYF(0)); - goto error; + my_message(ER_LOAD_INFILE_CAPABILITY_DISABLED, + ER_THD(thd, ER_LOAD_INFILE_CAPABILITY_DISABLED), MYF(0)); + goto error; } }