Post-merge fix. Moved the symlink handling from sql_parse.cc here.

parent eabe082d
...@@ -146,10 +146,10 @@ DATA DIRECTORY='TEST_DIR/master-data/test'; ...@@ -146,10 +146,10 @@ DATA DIRECTORY='TEST_DIR/master-data/test';
ERROR HY000: Incorrect arguments to DATA DIRECORY ERROR HY000: Incorrect arguments to DATA DIRECORY
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
DATA DIRECTORY='TEST_DIR/master-data/'; DATA DIRECTORY='TEST_DIR/master-data/';
DROP TABLE t1; ERROR HY000: Incorrect arguments to DATA DIRECORY
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data'; INDEX DIRECTORY='TEST_DIR/master-data';
DROP TABLE t1; ERROR HY000: Incorrect arguments to INDEX DIRECORY
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data_var'; INDEX DIRECTORY='TEST_DIR/master-data_var';
ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errcode: 2) ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errcode: 2)
......
...@@ -126,6 +126,9 @@ drop table t1; ...@@ -126,6 +126,9 @@ drop table t1;
--write_file $MYSQLTEST_VARDIR/tmp/t1.MYI --write_file $MYSQLTEST_VARDIR/tmp/t1.MYI
EOF EOF
--replace_result $MYSQLTEST_VARDIR TEST_DIR --replace_result $MYSQLTEST_VARDIR TEST_DIR
# If $MYSQLTEST_VARDIR is a symbolic link, the low level MyISAm error
# message contains the real path of $MYSQLTEST_VARDIR. Try to catch this.
--replace_regex /write to file '\/.*\/tmp/write to file 'TEST_DIR\/tmp/
--error 1 --error 1
eval CREATE TABLE t1(a INT) eval CREATE TABLE t1(a INT)
DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
...@@ -209,13 +212,13 @@ INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql'; ...@@ -209,13 +212,13 @@ INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql';
eval CREATE TABLE t1(a INT) eval CREATE TABLE t1(a INT)
DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/test'; DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/test';
--replace_result $MYSQLTEST_VARDIR TEST_DIR --replace_result $MYSQLTEST_VARDIR TEST_DIR
--error 1210
eval CREATE TABLE t1(a INT) eval CREATE TABLE t1(a INT)
DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/'; DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/';
DROP TABLE t1;
--replace_result $MYSQLTEST_VARDIR TEST_DIR --replace_result $MYSQLTEST_VARDIR TEST_DIR
--error 1210
eval CREATE TABLE t1(a INT) eval CREATE TABLE t1(a INT)
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data'; INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data';
DROP TABLE t1;
--replace_result $MYSQLTEST_VARDIR TEST_DIR --replace_result $MYSQLTEST_VARDIR TEST_DIR
--error 1 --error 1
eval CREATE TABLE t1(a INT) eval CREATE TABLE t1(a INT)
......
...@@ -3517,8 +3517,26 @@ bool mysql_create_table_no_lock(THD *thd, ...@@ -3517,8 +3517,26 @@ bool mysql_create_table_no_lock(THD *thd,
create_info->table_existed= 0; // Mark that table is created create_info->table_existed= 0; // Mark that table is created
#ifdef HAVE_READLINK #ifdef HAVE_READLINK
if (test_if_data_home_dir(create_info->data_file_name))
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "DATA DIRECTORY");
goto unlock_and_end;
}
if (test_if_data_home_dir(create_info->index_file_name))
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "INDEX DIRECTORY");
goto unlock_and_end;
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (check_partition_dirs(thd->lex->part_info))
{
goto unlock_and_end;
}
#endif /* WITH_PARTITION_STORAGE_ENGINE */
if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)) if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
#endif #endif /* HAVE_READLINK */
{ {
if (create_info->data_file_name) if (create_info->data_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment