Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt libmysql/libmysql.c: Auto merged mysql-test/include/mix1.inc: Auto merged mysql-test/r/innodb_mysql.result: Auto merged sql/field.cc: Auto merged sql/ha_partition.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_select.cc: Auto merged
This commit is contained in:
commit
2dd78add6b
@ -80,5 +80,6 @@ enum options_client
|
|||||||
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
|
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
|
||||||
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
|
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
|
||||||
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
|
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
|
||||||
OPT_WRITE_BINLOG, OPT_MAX_CLIENT_OPTION
|
OPT_WRITE_BINLOG, OPT_DUMP_DATE,
|
||||||
|
OPT_MAX_CLIENT_OPTION
|
||||||
};
|
};
|
||||||
|
@ -90,7 +90,7 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
|
|||||||
opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0,
|
opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0,
|
||||||
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
|
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
|
||||||
opt_alldbs=0,opt_create_db=0,opt_lock_all_tables=0,
|
opt_alldbs=0,opt_create_db=0,opt_lock_all_tables=0,
|
||||||
opt_set_charset=0,
|
opt_set_charset=0, opt_dump_date=1,
|
||||||
opt_autocommit=0,opt_disable_keys=1,opt_xml=0,
|
opt_autocommit=0,opt_disable_keys=1,opt_xml=0,
|
||||||
opt_delete_master_logs=0, tty_password=0,
|
opt_delete_master_logs=0, tty_password=0,
|
||||||
opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
|
opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
|
||||||
@ -424,6 +424,9 @@ static struct my_option my_long_options[] =
|
|||||||
"automatically turns off --lock-tables.",
|
"automatically turns off --lock-tables.",
|
||||||
(uchar**) &opt_single_transaction, (uchar**) &opt_single_transaction, 0,
|
(uchar**) &opt_single_transaction, (uchar**) &opt_single_transaction, 0,
|
||||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
{"dump-date", OPT_DUMP_DATE, "Put a dump date to the end of the output.",
|
||||||
|
(uchar**) &opt_dump_date, (uchar**) &opt_dump_date, 0,
|
||||||
|
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
|
||||||
{"skip-opt", OPT_SKIP_OPTIMIZATION,
|
{"skip-opt", OPT_SKIP_OPTIMIZATION,
|
||||||
"Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.",
|
"Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.",
|
||||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -651,10 +654,15 @@ static void write_footer(FILE *sql_file)
|
|||||||
fputs("\n", sql_file);
|
fputs("\n", sql_file);
|
||||||
if (opt_comments)
|
if (opt_comments)
|
||||||
{
|
{
|
||||||
char time_str[20];
|
if (opt_dump_date)
|
||||||
get_date(time_str, GETDATE_DATE_TIME, 0);
|
{
|
||||||
fprintf(sql_file, "-- Dump completed on %s\n",
|
char time_str[20];
|
||||||
time_str);
|
get_date(time_str, GETDATE_DATE_TIME, 0);
|
||||||
|
fprintf(sql_file, "-- Dump completed on %s\n",
|
||||||
|
time_str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(sql_file, "-- Dump completed\n");
|
||||||
}
|
}
|
||||||
check_io(sql_file);
|
check_io(sql_file);
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,8 @@ static my_bool opt_compress= FALSE, tty_password= FALSE,
|
|||||||
auto_generate_sql= FALSE;
|
auto_generate_sql= FALSE;
|
||||||
const char *auto_generate_sql_type= "mixed";
|
const char *auto_generate_sql_type= "mixed";
|
||||||
|
|
||||||
static unsigned long connect_flags= CLIENT_MULTI_RESULTS;
|
static unsigned long connect_flags= CLIENT_MULTI_RESULTS |
|
||||||
|
CLIENT_MULTI_STATEMENTS;
|
||||||
|
|
||||||
static int verbose, delimiter_length;
|
static int verbose, delimiter_length;
|
||||||
static uint commit_rate;
|
static uint commit_rate;
|
||||||
@ -1877,13 +1878,16 @@ limit_not_met:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mysql_field_count(mysql))
|
do
|
||||||
{
|
{
|
||||||
result= mysql_store_result(mysql);
|
if (mysql_field_count(mysql))
|
||||||
while ((row = mysql_fetch_row(result)))
|
{
|
||||||
counter++;
|
result= mysql_store_result(mysql);
|
||||||
mysql_free_result(result);
|
while ((row = mysql_fetch_row(result)))
|
||||||
}
|
counter++;
|
||||||
|
mysql_free_result(result);
|
||||||
|
}
|
||||||
|
} while(mysql_next_result(mysql) == 0);
|
||||||
queries++;
|
queries++;
|
||||||
|
|
||||||
if (commit_rate && commit_rate <= trans_counter)
|
if (commit_rate && commit_rate <= trans_counter)
|
||||||
|
@ -4352,6 +4352,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
|
|||||||
case MYSQL_TYPE_STRING:
|
case MYSQL_TYPE_STRING:
|
||||||
case MYSQL_TYPE_DECIMAL:
|
case MYSQL_TYPE_DECIMAL:
|
||||||
case MYSQL_TYPE_NEWDECIMAL:
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
|
case MYSQL_TYPE_NEWDATE:
|
||||||
DBUG_ASSERT(param->buffer_length != 0);
|
DBUG_ASSERT(param->buffer_length != 0);
|
||||||
param->fetch_result= fetch_result_str;
|
param->fetch_result= fetch_result_str;
|
||||||
break;
|
break;
|
||||||
@ -4424,6 +4425,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
|
|||||||
case MYSQL_TYPE_VAR_STRING:
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
case MYSQL_TYPE_STRING:
|
case MYSQL_TYPE_STRING:
|
||||||
case MYSQL_TYPE_BIT:
|
case MYSQL_TYPE_BIT:
|
||||||
|
case MYSQL_TYPE_NEWDATE:
|
||||||
param->skip_result= skip_result_string;
|
param->skip_result= skip_result_string;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -29,6 +29,7 @@ eval SET SESSION STORAGE_ENGINE = $engine_type;
|
|||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
|
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
|
||||||
|
drop procedure if exists p1;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
|
|
||||||
@ -1146,4 +1147,128 @@ select @b:=f2 from t1;
|
|||||||
select if(@a=@b,"ok","wrong");
|
select if(@a=@b,"ok","wrong");
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #31310: Locked rows silently skipped in read-committed isolation level.
|
||||||
|
#
|
||||||
|
|
||||||
|
connect (con1,localhost,root,,);
|
||||||
|
connect (con2,localhost,root,,);
|
||||||
|
SET SESSION AUTOCOMMIT = 0;
|
||||||
|
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||||
|
--echo # Switch to connection con1
|
||||||
|
connection con1;
|
||||||
|
|
||||||
|
eval
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
|
||||||
|
ENGINE = $engine_type;
|
||||||
|
INSERT INTO t1 VALUES (1,2);
|
||||||
|
|
||||||
|
--#echo 1. test for locking:
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
--enable_info
|
||||||
|
UPDATE t1 SET b = 12 WHERE a = 1;
|
||||||
|
--disable_info
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
--echo # Switch to connection con2
|
||||||
|
connection con2;
|
||||||
|
|
||||||
|
--enable_info
|
||||||
|
--disable_abort_on_error
|
||||||
|
--error ER_LOCK_WAIT_TIMEOUT
|
||||||
|
UPDATE t1 SET b = 21 WHERE a = 1;
|
||||||
|
--disable_info
|
||||||
|
|
||||||
|
--echo # Switch to connection con1
|
||||||
|
connection con1;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
ROLLBACK;
|
||||||
|
|
||||||
|
--echo # 2. test for serialized update:
|
||||||
|
|
||||||
|
CREATE TABLE t2 (a INT);
|
||||||
|
|
||||||
|
TRUNCATE t1;
|
||||||
|
INSERT INTO t1 VALUES (1,'init');
|
||||||
|
|
||||||
|
DELIMITER |;
|
||||||
|
CREATE PROCEDURE p1()
|
||||||
|
BEGIN
|
||||||
|
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
|
||||||
|
INSERT INTO t2 VALUES ();
|
||||||
|
END|
|
||||||
|
DELIMITER ;|
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
--enable_info
|
||||||
|
UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1;
|
||||||
|
--disable_info
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
--echo # Switch to connection con2
|
||||||
|
connection con2;
|
||||||
|
|
||||||
|
--send CALL p1;
|
||||||
|
|
||||||
|
--echo # Switch to connection con1
|
||||||
|
connection con1;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
let $bug31310 = 1;
|
||||||
|
while ($bug31310)
|
||||||
|
{
|
||||||
|
let $bug31310= `SELECT 1 - COUNT(*) FROM t2`;
|
||||||
|
}
|
||||||
|
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
--echo # Switch to connection con2
|
||||||
|
connection con2;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
--echo # Switch to connection con1
|
||||||
|
connection con1;
|
||||||
|
|
||||||
|
--echo # 3. test for updated key column:
|
||||||
|
|
||||||
|
TRUNCATE t1;
|
||||||
|
TRUNCATE t2;
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES (1,'init');
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
--enable_info
|
||||||
|
UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
|
||||||
|
--disable_info
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
--echo # Switch to connection con2
|
||||||
|
connection con2;
|
||||||
|
|
||||||
|
--send CALL p1;
|
||||||
|
|
||||||
|
--echo # Switch to connection con1
|
||||||
|
connection con1;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
let $bug31310 = 1;
|
||||||
|
while ($bug31310)
|
||||||
|
{
|
||||||
|
let $bug31310= `SELECT 1 - COUNT(*) FROM t2`;
|
||||||
|
}
|
||||||
|
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
--echo # Switch to connection con2
|
||||||
|
connection con2;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
disconnect con1;
|
||||||
|
disconnect con2;
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
@ -611,11 +611,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
||||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 ALL period NULL NULL NULL 41810 Using filesort
|
1 SIMPLE t3 index period period 4 NULL 1
|
||||||
1 SIMPLE t1 ref period period 4 test.t3.period 4181
|
1 SIMPLE t1 ref period period 4 test.t3.period 4181
|
||||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
|
1 SIMPLE t1 index period period 4 NULL 1
|
||||||
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
||||||
select period from t1;
|
select period from t1;
|
||||||
period
|
period
|
||||||
|
@ -478,7 +478,7 @@ str_to_date(a,b)
|
|||||||
create table t2 select str_to_date(a,b) from t1;
|
create table t2 select str_to_date(a,b) from t1;
|
||||||
describe t2;
|
describe t2;
|
||||||
Field Type Null Key Default Extra
|
Field Type Null Key Default Extra
|
||||||
str_to_date(a,b) binary(29) YES NULL
|
str_to_date(a,b) datetime YES NULL
|
||||||
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
|
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
|
||||||
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
|
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
|
||||||
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
|
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
|
||||||
|
@ -29,7 +29,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
|
|||||||
|
|
||||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||||
NULL mysqltest1 v1 SELECT 'ÔÅÓÔ' AS c1, ËÏÌ AS c2 NONE YES root@localhost DEFINER koi8r koi8r_general_ci
|
NULL mysqltest1 v1 SELECT 'ÔÅÓÔ' AS c1, ËÏÌ AS c2
|
||||||
|
FROM t1 NONE YES root@localhost DEFINER koi8r koi8r_general_ci
|
||||||
|
|
||||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||||
@ -68,7 +69,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
|
|||||||
|
|
||||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||||
NULL mysqltest1 v1 SELECT 'ÔÅÓÔ' AS c1, ËÏÌ AS c2 NONE YES root@localhost DEFINER koi8r koi8r_general_ci
|
NULL mysqltest1 v1 SELECT 'ÔÅÓÔ' AS c1, ËÏÌ AS c2
|
||||||
|
FROM t1 NONE YES root@localhost DEFINER koi8r koi8r_general_ci
|
||||||
|
|
||||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||||
|
@ -29,7 +29,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
|
|||||||
|
|
||||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||||
NULL mysqltest1 v1 SELECT 'тест' AS c1, кол AS c2 NONE YES root@localhost DEFINER utf8 utf8_general_ci
|
NULL mysqltest1 v1 SELECT 'тест' AS c1, кол AS c2
|
||||||
|
FROM t1 NONE YES root@localhost DEFINER utf8 utf8_general_ci
|
||||||
|
|
||||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||||
@ -68,7 +69,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
|
|||||||
|
|
||||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||||
NULL mysqltest1 v1 SELECT 'тест' AS c1, кол AS c2 NONE YES root@localhost DEFINER utf8 utf8_general_ci
|
NULL mysqltest1 v1 SELECT 'тест' AS c1, кол AS c2
|
||||||
|
FROM t1 NONE YES root@localhost DEFINER utf8 utf8_general_ci
|
||||||
|
|
||||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||||
|
@ -564,4 +564,9 @@ explain select f2 from t2 where f2 in (1,'b');
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 index t2f2 t2f2 5 NULL 3 Using where; Using index
|
1 SIMPLE t2 index t2f2 t2f2 5 NULL 3 Using where; Using index
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
create table t1 (a time, key(a));
|
||||||
|
insert into t1 values (),(),(),(),(),(),(),(),(),();
|
||||||
|
select a from t1 where a not in (a,a,a) group by a;
|
||||||
|
a
|
||||||
|
drop table t1;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
@ -369,4 +369,42 @@ mod(5, cast(-2 as unsigned)) mod(5, 18446744073709551614) mod(5, -2)
|
|||||||
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
|
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
|
||||||
pow(cast(-2 as unsigned), 5) pow(18446744073709551614, 5) pow(-2, 5)
|
pow(cast(-2 as unsigned), 5) pow(18446744073709551614, 5) pow(-2, 5)
|
||||||
2.1359870359209e+96 2.1359870359209e+96 -32
|
2.1359870359209e+96 2.1359870359209e+96 -32
|
||||||
|
CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
|
||||||
|
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
|
||||||
|
SELECT a DIV 900 y FROM t1 GROUP BY y;
|
||||||
|
y
|
||||||
|
22201025555
|
||||||
|
22255916666
|
||||||
|
SELECT DISTINCT a DIV 900 y FROM t1;
|
||||||
|
y
|
||||||
|
22201025555
|
||||||
|
22255916666
|
||||||
|
SELECT b DIV 900 y FROM t1 GROUP BY y;
|
||||||
|
y
|
||||||
|
0
|
||||||
|
SELECT c DIV 900 y FROM t1 GROUP BY y;
|
||||||
|
y
|
||||||
|
0
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1(a LONGBLOB);
|
||||||
|
INSERT INTO t1 VALUES('1'),('2'),('3');
|
||||||
|
SELECT DISTINCT (a DIV 254576881) FROM t1;
|
||||||
|
(a DIV 254576881)
|
||||||
|
0
|
||||||
|
SELECT (a DIV 254576881) FROM t1 UNION ALL
|
||||||
|
SELECT (a DIV 254576881) FROM t1;
|
||||||
|
(a DIV 254576881)
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1(a SET('a','b','c'));
|
||||||
|
INSERT INTO t1 VALUES ('a');
|
||||||
|
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
|
||||||
|
a DIV 2
|
||||||
|
0
|
||||||
|
DROP TABLE t1;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
|
@ -190,6 +190,28 @@ ERROR 21000: Operand should contain 1 column(s)
|
|||||||
drop table table_26093;
|
drop table table_26093;
|
||||||
drop function func_26093_a;
|
drop function func_26093_a;
|
||||||
drop function func_26093_b;
|
drop function func_26093_b;
|
||||||
|
SELECT NAME_CONST('test', NOW());
|
||||||
|
ERROR HY000: Incorrect arguments to NAME_CONST
|
||||||
|
SELECT NAME_CONST('test', UPPER('test'));
|
||||||
|
ERROR HY000: Incorrect arguments to NAME_CONST
|
||||||
|
SELECT NAME_CONST('test', NULL);
|
||||||
|
test
|
||||||
|
NULL
|
||||||
|
SELECT NAME_CONST('test', 1);
|
||||||
|
test
|
||||||
|
1
|
||||||
|
SELECT NAME_CONST('test', -1);
|
||||||
|
test
|
||||||
|
-1
|
||||||
|
SELECT NAME_CONST('test', 1.0);
|
||||||
|
test
|
||||||
|
1.0
|
||||||
|
SELECT NAME_CONST('test', -1.0);
|
||||||
|
test
|
||||||
|
-1.0
|
||||||
|
SELECT NAME_CONST('test', 'test');
|
||||||
|
test
|
||||||
|
test
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
select connection_id() > 0;
|
select connection_id() > 0;
|
||||||
connection_id() > 0
|
connection_id() > 0
|
||||||
|
@ -196,7 +196,7 @@ f2 datetime YES NULL
|
|||||||
f3 time YES NULL
|
f3 time YES NULL
|
||||||
f4 time YES NULL
|
f4 time YES NULL
|
||||||
f5 time YES NULL
|
f5 time YES NULL
|
||||||
f6 time NO 00:00:00
|
f6 time YES NULL
|
||||||
f7 datetime YES NULL
|
f7 datetime YES NULL
|
||||||
f8 date YES NULL
|
f8 date YES NULL
|
||||||
f9 time YES NULL
|
f9 time YES NULL
|
||||||
|
@ -1027,6 +1027,15 @@ fmtddate field2
|
|||||||
Sep-4 12:00AM abcd
|
Sep-4 12:00AM abcd
|
||||||
DROP TABLE testBug8868;
|
DROP TABLE testBug8868;
|
||||||
SET NAMES DEFAULT;
|
SET NAMES DEFAULT;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a TIMESTAMP
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES (now()), (now());
|
||||||
|
SELECT 1 FROM t1 ORDER BY MAKETIME(1, 1, a);
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
DROP TABLE t1;
|
||||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
|
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
|
||||||
union
|
union
|
||||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
|
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
|
||||||
|
@ -1425,6 +1425,37 @@ CHECK TABLE t1 EXTENDED;
|
|||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t1 check status OK
|
test.t1 check status OK
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
create table t1 (a geometry not null, spatial index(a));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
|
||||||
|
drop table t1;
|
||||||
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
|
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
|
||||||
INSERT INTO t1(foo) VALUES (NULL);
|
INSERT INTO t1(foo) VALUES (NULL);
|
||||||
ERROR 23000: Column 'foo' cannot be null
|
ERROR 23000: Column 'foo' cannot be null
|
||||||
|
@ -736,6 +736,12 @@ SELECT * FROM t1;
|
|||||||
a
|
a
|
||||||
NULL
|
NULL
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
|
||||||
|
INSERT INTO `t1` VALUES ('','0000-00-00');
|
||||||
|
select geomfromtext(col9,col89) as a from t1;
|
||||||
|
a
|
||||||
|
NULL
|
||||||
|
DROP TABLE t1;
|
||||||
End of 4.1 tests
|
End of 4.1 tests
|
||||||
create table t1 (s1 geometry not null,s2 char(100));
|
create table t1 (s1 geometry not null,s2 char(100));
|
||||||
create trigger t1_bu before update on t1 for each row set new.s1 = null;
|
create trigger t1_bu before update on t1 for each row set new.s1 = null;
|
||||||
|
@ -422,4 +422,22 @@ revoke all privileges, grant option from mysqltest_1@localhost;
|
|||||||
revoke all privileges, grant option from mysqltest_2@localhost;
|
revoke all privileges, grant option from mysqltest_2@localhost;
|
||||||
drop user mysqltest_1@localhost;
|
drop user mysqltest_1@localhost;
|
||||||
drop user mysqltest_2@localhost;
|
drop user mysqltest_2@localhost;
|
||||||
|
CREATE DATABASE db1;
|
||||||
|
USE db1;
|
||||||
|
CREATE TABLE t1 (a INT, b INT);
|
||||||
|
INSERT INTO t1 VALUES (1,1),(2,2);
|
||||||
|
CREATE TABLE t2 (b INT, c INT);
|
||||||
|
INSERT INTO t2 VALUES (1,100),(2,200);
|
||||||
|
GRANT SELECT ON t1 TO mysqltest1@localhost;
|
||||||
|
GRANT SELECT (b) ON t2 TO mysqltest1@localhost;
|
||||||
|
USE db1;
|
||||||
|
SELECT c FROM t2;
|
||||||
|
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||||
|
SELECT * FROM t2;
|
||||||
|
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||||
|
SELECT * FROM t1 JOIN t2 USING (b);
|
||||||
|
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||||
|
DROP TABLE db1.t1, db1.t2;
|
||||||
|
DROP USER mysqltest1@localhost;
|
||||||
|
DROP DATABASE db1;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
|
@ -1093,10 +1093,156 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 144
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 144
|
||||||
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort
|
1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index
|
||||||
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort
|
1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index
|
||||||
|
SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
11
|
||||||
|
12
|
||||||
|
13
|
||||||
|
14
|
||||||
|
15
|
||||||
|
16
|
||||||
|
17
|
||||||
|
18
|
||||||
|
19
|
||||||
|
20
|
||||||
|
21
|
||||||
|
22
|
||||||
|
23
|
||||||
|
24
|
||||||
|
25
|
||||||
|
26
|
||||||
|
27
|
||||||
|
28
|
||||||
|
29
|
||||||
|
30
|
||||||
|
31
|
||||||
|
32
|
||||||
|
33
|
||||||
|
34
|
||||||
|
35
|
||||||
|
36
|
||||||
|
37
|
||||||
|
38
|
||||||
|
39
|
||||||
|
40
|
||||||
|
41
|
||||||
|
42
|
||||||
|
43
|
||||||
|
44
|
||||||
|
45
|
||||||
|
46
|
||||||
|
47
|
||||||
|
48
|
||||||
|
49
|
||||||
|
50
|
||||||
|
51
|
||||||
|
52
|
||||||
|
53
|
||||||
|
54
|
||||||
|
55
|
||||||
|
56
|
||||||
|
57
|
||||||
|
58
|
||||||
|
59
|
||||||
|
60
|
||||||
|
61
|
||||||
|
62
|
||||||
|
63
|
||||||
|
64
|
||||||
|
65
|
||||||
|
66
|
||||||
|
67
|
||||||
|
68
|
||||||
|
69
|
||||||
|
70
|
||||||
|
71
|
||||||
|
72
|
||||||
|
73
|
||||||
|
74
|
||||||
|
75
|
||||||
|
76
|
||||||
|
77
|
||||||
|
78
|
||||||
|
79
|
||||||
|
80
|
||||||
|
81
|
||||||
|
82
|
||||||
|
83
|
||||||
|
84
|
||||||
|
85
|
||||||
|
86
|
||||||
|
87
|
||||||
|
88
|
||||||
|
89
|
||||||
|
90
|
||||||
|
91
|
||||||
|
92
|
||||||
|
93
|
||||||
|
94
|
||||||
|
95
|
||||||
|
96
|
||||||
|
97
|
||||||
|
98
|
||||||
|
99
|
||||||
|
100
|
||||||
|
101
|
||||||
|
102
|
||||||
|
103
|
||||||
|
104
|
||||||
|
105
|
||||||
|
106
|
||||||
|
107
|
||||||
|
108
|
||||||
|
109
|
||||||
|
110
|
||||||
|
111
|
||||||
|
112
|
||||||
|
113
|
||||||
|
114
|
||||||
|
115
|
||||||
|
116
|
||||||
|
117
|
||||||
|
118
|
||||||
|
119
|
||||||
|
120
|
||||||
|
121
|
||||||
|
122
|
||||||
|
123
|
||||||
|
124
|
||||||
|
125
|
||||||
|
126
|
||||||
|
127
|
||||||
|
128
|
||||||
|
129
|
||||||
|
130
|
||||||
|
131
|
||||||
|
132
|
||||||
|
133
|
||||||
|
134
|
||||||
|
135
|
||||||
|
136
|
||||||
|
137
|
||||||
|
138
|
||||||
|
139
|
||||||
|
140
|
||||||
|
141
|
||||||
|
142
|
||||||
|
143
|
||||||
|
144
|
||||||
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY)
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY)
|
||||||
IGNORE INDEX FOR GROUP BY (i2) GROUP BY a;
|
IGNORE INDEX FOR GROUP BY (i2) GROUP BY a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
@ -387,10 +387,14 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
|
|||||||
select * from information_schema.views where TABLE_NAME like "v%";
|
select * from information_schema.views where TABLE_NAME like "v%";
|
||||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||||
NULL test v0 select schema_name from information_schema.schemata NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
NULL test v0 select schema_name from information_schema.schemata NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||||
NULL test v1 select table_name from information_schema.tables NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
NULL test v1 select table_name from information_schema.tables
|
||||||
NULL test v2 select column_name from information_schema.columns NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
where table_name="v1" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||||
NULL test v3 select CHARACTER_SET_NAME from information_schema.character_sets NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
NULL test v2 select column_name from information_schema.columns
|
||||||
NULL test v4 select COLLATION_NAME from information_schema.collations NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
where table_name="v2" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||||
|
NULL test v3 select CHARACTER_SET_NAME from information_schema.character_sets
|
||||||
|
where CHARACTER_SET_NAME like "latin1%" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||||
|
NULL test v4 select COLLATION_NAME from information_schema.collations
|
||||||
|
where COLLATION_NAME like "latin1%" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||||
drop view v0, v1, v2, v3, v4;
|
drop view v0, v1, v2, v3, v4;
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
grant select,update,insert on t1 to mysqltest_1@localhost;
|
grant select,update,insert on t1 to mysqltest_1@localhost;
|
||||||
@ -1466,6 +1470,10 @@ f7 datetime NO NULL
|
|||||||
f8 datetime YES 2006-01-01 00:00:00
|
f8 datetime YES 2006-01-01 00:00:00
|
||||||
drop table t1;
|
drop table t1;
|
||||||
End of 5.0 tests.
|
End of 5.0 tests.
|
||||||
|
show fields from information_schema.table_names;
|
||||||
|
ERROR 42S02: Unknown table 'table_names' in information_schema
|
||||||
|
show keys from information_schema.table_names;
|
||||||
|
ERROR 42S02: Unknown table 'table_names' in information_schema
|
||||||
select * from information_schema.engines WHERE ENGINE="MyISAM";
|
select * from information_schema.engines WHERE ENGINE="MyISAM";
|
||||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||||
MyISAM DEFAULT Default engine as of MySQL 3.23 with great performance NO NO NO
|
MyISAM DEFAULT Default engine as of MySQL 3.23 with great performance NO NO NO
|
||||||
@ -1540,4 +1548,16 @@ count(*)
|
|||||||
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='nonexisting';
|
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='nonexisting';
|
||||||
count(*)
|
count(*)
|
||||||
0
|
0
|
||||||
|
CREATE VIEW v1
|
||||||
|
AS SELECT *
|
||||||
|
FROM INFORMATION_SCHEMA.TABLES;
|
||||||
|
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS where TABLE_NAME = 'v1';
|
||||||
|
VIEW_DEFINITION
|
||||||
|
SELECT *
|
||||||
|
FROM INFORMATION_SCHEMA.TABLES
|
||||||
|
DROP VIEW v1;
|
||||||
|
SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA
|
||||||
|
WHERE SCHEMA_NAME ='information_schema';
|
||||||
|
SCHEMA_NAME
|
||||||
|
information_schema
|
||||||
End of 5.1 tests.
|
End of 5.1 tests.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||||
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
|
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
|
||||||
|
drop procedure if exists p1;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
c_id int(11) not null default '0',
|
c_id int(11) not null default '0',
|
||||||
org_id int(11) default null,
|
org_id int(11) default null,
|
||||||
@ -1419,4 +1420,83 @@ select if(@a=@b,"ok","wrong");
|
|||||||
if(@a=@b,"ok","wrong")
|
if(@a=@b,"ok","wrong")
|
||||||
ok
|
ok
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
SET SESSION AUTOCOMMIT = 0;
|
||||||
|
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||||
|
# Switch to connection con1
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (1,2);
|
||||||
|
BEGIN;
|
||||||
|
UPDATE t1 SET b = 12 WHERE a = 1;
|
||||||
|
affected rows: 1
|
||||||
|
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
1 12
|
||||||
|
# Switch to connection con2
|
||||||
|
UPDATE t1 SET b = 21 WHERE a = 1;
|
||||||
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
|
# Switch to connection con1
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
1 12
|
||||||
|
ROLLBACK;
|
||||||
|
# 2. test for serialized update:
|
||||||
|
CREATE TABLE t2 (a INT);
|
||||||
|
TRUNCATE t1;
|
||||||
|
INSERT INTO t1 VALUES (1,'init');
|
||||||
|
CREATE PROCEDURE p1()
|
||||||
|
BEGIN
|
||||||
|
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
|
||||||
|
INSERT INTO t2 VALUES ();
|
||||||
|
END|
|
||||||
|
BEGIN;
|
||||||
|
UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1;
|
||||||
|
affected rows: 1
|
||||||
|
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
1 init+con1
|
||||||
|
# Switch to connection con2
|
||||||
|
CALL p1;;
|
||||||
|
# Switch to connection con1
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
1 init+con1
|
||||||
|
COMMIT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
1 init+con1
|
||||||
|
# Switch to connection con2
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
1 init+con1+con2
|
||||||
|
# Switch to connection con1
|
||||||
|
# 3. test for updated key column:
|
||||||
|
TRUNCATE t1;
|
||||||
|
TRUNCATE t2;
|
||||||
|
INSERT INTO t1 VALUES (1,'init');
|
||||||
|
BEGIN;
|
||||||
|
UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
|
||||||
|
affected rows: 1
|
||||||
|
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
2 init+con1
|
||||||
|
# Switch to connection con2
|
||||||
|
CALL p1;;
|
||||||
|
# Switch to connection con1
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
2 init+con1
|
||||||
|
COMMIT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
2 init+con1
|
||||||
|
# Switch to connection con2
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a b
|
||||||
|
2 init+con1
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
@ -816,3 +816,15 @@ id prev_id join_id
|
|||||||
3 2 0
|
3 2 0
|
||||||
4 3 0
|
4 3 0
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
#
|
||||||
|
# Bug#30384: Having SQL_BUFFER_RESULT option in the
|
||||||
|
# CREATE .. KEY(..) .. SELECT led to creating corrupted index.
|
||||||
|
#
|
||||||
|
create table t1(f1 int);
|
||||||
|
insert into t1 values(1),(2),(3);
|
||||||
|
create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
|
||||||
|
check table t2 extended;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t2 check status OK
|
||||||
|
drop table t1,t2;
|
||||||
|
##################################################################
|
||||||
|
@ -897,4 +897,168 @@ select '^^: The above should be ~= 20 + cost(select * from t1). Value less than
|
|||||||
Z
|
Z
|
||||||
^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error
|
^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
|
||||||
|
CREATE TABLE t2 (c INT PRIMARY KEY, d INT);
|
||||||
|
INSERT INTO t1 VALUES(1,NULL),(2,NULL),(3,NULL),(4,NULL);
|
||||||
|
INSERT INTO t1 SELECT a + 4, b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a + 8, b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a + 16, b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a + 32, b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a + 64, b FROM t1;
|
||||||
|
INSERT INTO t2 SELECT a, b FROM t1;
|
||||||
|
EXPLAIN SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a LIMIT 2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 index NULL PRIMARY 4 NULL 2
|
||||||
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1
|
||||||
|
EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2
|
||||||
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1
|
||||||
|
SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a LIMIT 2;
|
||||||
|
a b c d
|
||||||
|
SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2;
|
||||||
|
a b c d
|
||||||
|
1 NULL 1 NULL
|
||||||
|
2 NULL 2 NULL
|
||||||
|
EXPLAIN SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort
|
||||||
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1
|
||||||
|
EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 128 Using filesort
|
||||||
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1
|
||||||
|
SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a;
|
||||||
|
a b c d
|
||||||
|
SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
|
||||||
|
a b c d
|
||||||
|
1 NULL 1 NULL
|
||||||
|
2 NULL 2 NULL
|
||||||
|
3 NULL 3 NULL
|
||||||
|
4 NULL 4 NULL
|
||||||
|
5 NULL 5 NULL
|
||||||
|
6 NULL 6 NULL
|
||||||
|
7 NULL 7 NULL
|
||||||
|
8 NULL 8 NULL
|
||||||
|
9 NULL 9 NULL
|
||||||
|
10 NULL 10 NULL
|
||||||
|
11 NULL 11 NULL
|
||||||
|
12 NULL 12 NULL
|
||||||
|
13 NULL 13 NULL
|
||||||
|
14 NULL 14 NULL
|
||||||
|
15 NULL 15 NULL
|
||||||
|
16 NULL 16 NULL
|
||||||
|
17 NULL 17 NULL
|
||||||
|
18 NULL 18 NULL
|
||||||
|
19 NULL 19 NULL
|
||||||
|
20 NULL 20 NULL
|
||||||
|
21 NULL 21 NULL
|
||||||
|
22 NULL 22 NULL
|
||||||
|
23 NULL 23 NULL
|
||||||
|
24 NULL 24 NULL
|
||||||
|
25 NULL 25 NULL
|
||||||
|
26 NULL 26 NULL
|
||||||
|
27 NULL 27 NULL
|
||||||
|
28 NULL 28 NULL
|
||||||
|
29 NULL 29 NULL
|
||||||
|
30 NULL 30 NULL
|
||||||
|
31 NULL 31 NULL
|
||||||
|
32 NULL 32 NULL
|
||||||
|
33 NULL 33 NULL
|
||||||
|
34 NULL 34 NULL
|
||||||
|
35 NULL 35 NULL
|
||||||
|
36 NULL 36 NULL
|
||||||
|
37 NULL 37 NULL
|
||||||
|
38 NULL 38 NULL
|
||||||
|
39 NULL 39 NULL
|
||||||
|
40 NULL 40 NULL
|
||||||
|
41 NULL 41 NULL
|
||||||
|
42 NULL 42 NULL
|
||||||
|
43 NULL 43 NULL
|
||||||
|
44 NULL 44 NULL
|
||||||
|
45 NULL 45 NULL
|
||||||
|
46 NULL 46 NULL
|
||||||
|
47 NULL 47 NULL
|
||||||
|
48 NULL 48 NULL
|
||||||
|
49 NULL 49 NULL
|
||||||
|
50 NULL 50 NULL
|
||||||
|
51 NULL 51 NULL
|
||||||
|
52 NULL 52 NULL
|
||||||
|
53 NULL 53 NULL
|
||||||
|
54 NULL 54 NULL
|
||||||
|
55 NULL 55 NULL
|
||||||
|
56 NULL 56 NULL
|
||||||
|
57 NULL 57 NULL
|
||||||
|
58 NULL 58 NULL
|
||||||
|
59 NULL 59 NULL
|
||||||
|
60 NULL 60 NULL
|
||||||
|
61 NULL 61 NULL
|
||||||
|
62 NULL 62 NULL
|
||||||
|
63 NULL 63 NULL
|
||||||
|
64 NULL 64 NULL
|
||||||
|
65 NULL 65 NULL
|
||||||
|
66 NULL 66 NULL
|
||||||
|
67 NULL 67 NULL
|
||||||
|
68 NULL 68 NULL
|
||||||
|
69 NULL 69 NULL
|
||||||
|
70 NULL 70 NULL
|
||||||
|
71 NULL 71 NULL
|
||||||
|
72 NULL 72 NULL
|
||||||
|
73 NULL 73 NULL
|
||||||
|
74 NULL 74 NULL
|
||||||
|
75 NULL 75 NULL
|
||||||
|
76 NULL 76 NULL
|
||||||
|
77 NULL 77 NULL
|
||||||
|
78 NULL 78 NULL
|
||||||
|
79 NULL 79 NULL
|
||||||
|
80 NULL 80 NULL
|
||||||
|
81 NULL 81 NULL
|
||||||
|
82 NULL 82 NULL
|
||||||
|
83 NULL 83 NULL
|
||||||
|
84 NULL 84 NULL
|
||||||
|
85 NULL 85 NULL
|
||||||
|
86 NULL 86 NULL
|
||||||
|
87 NULL 87 NULL
|
||||||
|
88 NULL 88 NULL
|
||||||
|
89 NULL 89 NULL
|
||||||
|
90 NULL 90 NULL
|
||||||
|
91 NULL 91 NULL
|
||||||
|
92 NULL 92 NULL
|
||||||
|
93 NULL 93 NULL
|
||||||
|
94 NULL 94 NULL
|
||||||
|
95 NULL 95 NULL
|
||||||
|
96 NULL 96 NULL
|
||||||
|
97 NULL 97 NULL
|
||||||
|
98 NULL 98 NULL
|
||||||
|
99 NULL 99 NULL
|
||||||
|
100 NULL 100 NULL
|
||||||
|
101 NULL 101 NULL
|
||||||
|
102 NULL 102 NULL
|
||||||
|
103 NULL 103 NULL
|
||||||
|
104 NULL 104 NULL
|
||||||
|
105 NULL 105 NULL
|
||||||
|
106 NULL 106 NULL
|
||||||
|
107 NULL 107 NULL
|
||||||
|
108 NULL 108 NULL
|
||||||
|
109 NULL 109 NULL
|
||||||
|
110 NULL 110 NULL
|
||||||
|
111 NULL 111 NULL
|
||||||
|
112 NULL 112 NULL
|
||||||
|
113 NULL 113 NULL
|
||||||
|
114 NULL 114 NULL
|
||||||
|
115 NULL 115 NULL
|
||||||
|
116 NULL 116 NULL
|
||||||
|
117 NULL 117 NULL
|
||||||
|
118 NULL 118 NULL
|
||||||
|
119 NULL 119 NULL
|
||||||
|
120 NULL 120 NULL
|
||||||
|
121 NULL 121 NULL
|
||||||
|
122 NULL 122 NULL
|
||||||
|
123 NULL 123 NULL
|
||||||
|
124 NULL 124 NULL
|
||||||
|
125 NULL 125 NULL
|
||||||
|
126 NULL 126 NULL
|
||||||
|
127 NULL 127 NULL
|
||||||
|
128 NULL 128 NULL
|
||||||
|
DROP TABLE IF EXISTS t1,t2;
|
||||||
End of 5.0 tests.
|
End of 5.0 tests.
|
||||||
|
@ -3805,6 +3805,28 @@ c1
|
|||||||
2
|
2
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
#
|
#
|
||||||
|
# Bug#29815: new option for suppressing last line of mysqldump:
|
||||||
|
# "Dump completed on"
|
||||||
|
#
|
||||||
|
# --skip-dump-date:
|
||||||
|
--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Dump completed
|
||||||
|
# --dump-date:
|
||||||
|
--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Dump completed on DATE
|
||||||
|
# --dump-date (default):
|
||||||
|
--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Dump completed on DATE
|
||||||
|
#
|
||||||
# End of 5.0 tests
|
# End of 5.0 tests
|
||||||
#
|
#
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
|
@ -211,3 +211,9 @@ COMMIT;
|
|||||||
COMMIT;
|
COMMIT;
|
||||||
SHOW TABLES;
|
SHOW TABLES;
|
||||||
DROP SCHEMA IF EXISTS `mysqlslap`;
|
DROP SCHEMA IF EXISTS `mysqlslap`;
|
||||||
|
#
|
||||||
|
# Bug #29985: mysqlslap -- improper handling of resultsets in SPROCs
|
||||||
|
#
|
||||||
|
DROP PROCEDURE IF EXISTS p1;
|
||||||
|
CREATE PROCEDURE p1() SELECT 1;
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
@ -715,3 +715,14 @@ a SUM(a)
|
|||||||
4 4
|
4 4
|
||||||
NULL 14
|
NULL 14
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# Bug#31095: Unexpected NULL constant caused server crash.
|
||||||
|
#
|
||||||
|
create table t1(a int);
|
||||||
|
insert into t1 values (1),(2),(3);
|
||||||
|
select count(a) from t1 group by null with rollup;
|
||||||
|
count(a)
|
||||||
|
3
|
||||||
|
3
|
||||||
|
drop table t1;
|
||||||
|
##############################################################
|
||||||
|
@ -1131,3 +1131,288 @@ id c3
|
|||||||
186 14
|
186 14
|
||||||
196 14
|
196 14
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a INT,
|
||||||
|
b INT,
|
||||||
|
PRIMARY KEY (a),
|
||||||
|
KEY ab(a, b)
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
|
||||||
|
INSERT INTO t1 SELECT a + 4, b + 4 FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a + 8, b + 8 FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a +16, b +16 FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a +32, b +32 FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a +64, b +64 FROM t1;
|
||||||
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 range NULL ab 4 NULL 10 Using index for group-by
|
||||||
|
SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
11
|
||||||
|
12
|
||||||
|
13
|
||||||
|
14
|
||||||
|
15
|
||||||
|
16
|
||||||
|
17
|
||||||
|
18
|
||||||
|
19
|
||||||
|
20
|
||||||
|
21
|
||||||
|
22
|
||||||
|
23
|
||||||
|
24
|
||||||
|
25
|
||||||
|
26
|
||||||
|
27
|
||||||
|
28
|
||||||
|
29
|
||||||
|
30
|
||||||
|
31
|
||||||
|
32
|
||||||
|
33
|
||||||
|
34
|
||||||
|
35
|
||||||
|
36
|
||||||
|
37
|
||||||
|
38
|
||||||
|
39
|
||||||
|
40
|
||||||
|
41
|
||||||
|
42
|
||||||
|
43
|
||||||
|
44
|
||||||
|
45
|
||||||
|
46
|
||||||
|
47
|
||||||
|
48
|
||||||
|
49
|
||||||
|
50
|
||||||
|
51
|
||||||
|
52
|
||||||
|
53
|
||||||
|
54
|
||||||
|
55
|
||||||
|
56
|
||||||
|
57
|
||||||
|
58
|
||||||
|
59
|
||||||
|
60
|
||||||
|
61
|
||||||
|
62
|
||||||
|
63
|
||||||
|
64
|
||||||
|
65
|
||||||
|
66
|
||||||
|
67
|
||||||
|
68
|
||||||
|
69
|
||||||
|
70
|
||||||
|
71
|
||||||
|
72
|
||||||
|
73
|
||||||
|
74
|
||||||
|
75
|
||||||
|
76
|
||||||
|
77
|
||||||
|
78
|
||||||
|
79
|
||||||
|
80
|
||||||
|
81
|
||||||
|
82
|
||||||
|
83
|
||||||
|
84
|
||||||
|
85
|
||||||
|
86
|
||||||
|
87
|
||||||
|
88
|
||||||
|
89
|
||||||
|
90
|
||||||
|
91
|
||||||
|
92
|
||||||
|
93
|
||||||
|
94
|
||||||
|
95
|
||||||
|
96
|
||||||
|
97
|
||||||
|
98
|
||||||
|
99
|
||||||
|
100
|
||||||
|
101
|
||||||
|
102
|
||||||
|
103
|
||||||
|
104
|
||||||
|
105
|
||||||
|
106
|
||||||
|
107
|
||||||
|
108
|
||||||
|
109
|
||||||
|
110
|
||||||
|
111
|
||||||
|
112
|
||||||
|
113
|
||||||
|
114
|
||||||
|
115
|
||||||
|
116
|
||||||
|
117
|
||||||
|
118
|
||||||
|
119
|
||||||
|
120
|
||||||
|
121
|
||||||
|
122
|
||||||
|
123
|
||||||
|
124
|
||||||
|
125
|
||||||
|
126
|
||||||
|
127
|
||||||
|
128
|
||||||
|
SELECT @tmp_tables_after = @tmp_tables_before ;
|
||||||
|
@tmp_tables_after = @tmp_tables_before
|
||||||
|
1
|
||||||
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using index
|
||||||
|
SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
11
|
||||||
|
12
|
||||||
|
13
|
||||||
|
14
|
||||||
|
15
|
||||||
|
16
|
||||||
|
17
|
||||||
|
18
|
||||||
|
19
|
||||||
|
20
|
||||||
|
21
|
||||||
|
22
|
||||||
|
23
|
||||||
|
24
|
||||||
|
25
|
||||||
|
26
|
||||||
|
27
|
||||||
|
28
|
||||||
|
29
|
||||||
|
30
|
||||||
|
31
|
||||||
|
32
|
||||||
|
33
|
||||||
|
34
|
||||||
|
35
|
||||||
|
36
|
||||||
|
37
|
||||||
|
38
|
||||||
|
39
|
||||||
|
40
|
||||||
|
41
|
||||||
|
42
|
||||||
|
43
|
||||||
|
44
|
||||||
|
45
|
||||||
|
46
|
||||||
|
47
|
||||||
|
48
|
||||||
|
49
|
||||||
|
50
|
||||||
|
51
|
||||||
|
52
|
||||||
|
53
|
||||||
|
54
|
||||||
|
55
|
||||||
|
56
|
||||||
|
57
|
||||||
|
58
|
||||||
|
59
|
||||||
|
60
|
||||||
|
61
|
||||||
|
62
|
||||||
|
63
|
||||||
|
64
|
||||||
|
65
|
||||||
|
66
|
||||||
|
67
|
||||||
|
68
|
||||||
|
69
|
||||||
|
70
|
||||||
|
71
|
||||||
|
72
|
||||||
|
73
|
||||||
|
74
|
||||||
|
75
|
||||||
|
76
|
||||||
|
77
|
||||||
|
78
|
||||||
|
79
|
||||||
|
80
|
||||||
|
81
|
||||||
|
82
|
||||||
|
83
|
||||||
|
84
|
||||||
|
85
|
||||||
|
86
|
||||||
|
87
|
||||||
|
88
|
||||||
|
89
|
||||||
|
90
|
||||||
|
91
|
||||||
|
92
|
||||||
|
93
|
||||||
|
94
|
||||||
|
95
|
||||||
|
96
|
||||||
|
97
|
||||||
|
98
|
||||||
|
99
|
||||||
|
100
|
||||||
|
101
|
||||||
|
102
|
||||||
|
103
|
||||||
|
104
|
||||||
|
105
|
||||||
|
106
|
||||||
|
107
|
||||||
|
108
|
||||||
|
109
|
||||||
|
110
|
||||||
|
111
|
||||||
|
112
|
||||||
|
113
|
||||||
|
114
|
||||||
|
115
|
||||||
|
116
|
||||||
|
117
|
||||||
|
118
|
||||||
|
119
|
||||||
|
120
|
||||||
|
121
|
||||||
|
122
|
||||||
|
123
|
||||||
|
124
|
||||||
|
125
|
||||||
|
126
|
||||||
|
127
|
||||||
|
128
|
||||||
|
SELECT @tmp_tables_after = @tmp_tables_before;
|
||||||
|
@tmp_tables_after = @tmp_tables_before
|
||||||
|
1
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -607,11 +607,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
||||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 ALL period NULL NULL NULL 41810 Using filesort
|
1 SIMPLE t3 index period period 4 NULL 1
|
||||||
1 SIMPLE t1 ref period period 4 test.t3.period 4181
|
1 SIMPLE t1 ref period period 4 test.t3.period 4181
|
||||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
|
1 SIMPLE t1 index period period 4 NULL 1
|
||||||
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
||||||
select period from t1;
|
select period from t1;
|
||||||
period
|
period
|
||||||
|
@ -608,11 +608,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
||||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 ALL period NULL NULL NULL 41810 Using filesort
|
1 SIMPLE t3 index period period 4 NULL 1
|
||||||
1 SIMPLE t1 ref period period 4 test.t3.period 4181
|
1 SIMPLE t1 ref period period 4 test.t3.period 4181
|
||||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
|
1 SIMPLE t1 index period period 4 NULL 1
|
||||||
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
||||||
select period from t1;
|
select period from t1;
|
||||||
period
|
period
|
||||||
|
@ -611,11 +611,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
||||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 ALL period NULL NULL NULL 41810 Using filesort
|
1 SIMPLE t3 index period period 4 NULL 1
|
||||||
1 SIMPLE t1 ref period period 4 test.t3.period 4181
|
1 SIMPLE t1 ref period period 4 test.t3.period 4181
|
||||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
|
1 SIMPLE t1 index period period 4 NULL 1
|
||||||
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
||||||
select period from t1;
|
select period from t1;
|
||||||
period
|
period
|
||||||
|
@ -145,3 +145,13 @@ d dt ts
|
|||||||
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00
|
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||||
2001-11-11 2001-11-11 00:00:00 2001-11-11 00:00:00
|
2001-11-11 2001-11-11 00:00:00 2001-11-11 00:00:00
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a INT
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
INSERT INTO t1 VALUES (NULL);
|
||||||
|
SELECT str_to_date( '', a ) FROM t1;
|
||||||
|
str_to_date( '', a )
|
||||||
|
0000-00-00 00:00:00
|
||||||
|
NULL
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -427,6 +427,67 @@ f1
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 1
|
Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# Bug#27216: functions with parameters of different date types may
|
||||||
|
# return wrong type of the result.
|
||||||
|
#
|
||||||
|
create table t1 (f1 date, f2 datetime, f3 varchar(20));
|
||||||
|
create table t2 as select coalesce(f1,f1) as f4 from t1;
|
||||||
|
desc t2;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 date YES NULL
|
||||||
|
create table t3 as select coalesce(f1,f2) as f4 from t1;
|
||||||
|
desc t3;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 datetime YES NULL
|
||||||
|
create table t4 as select coalesce(f2,f2) as f4 from t1;
|
||||||
|
desc t4;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 datetime YES NULL
|
||||||
|
create table t5 as select coalesce(f1,f3) as f4 from t1;
|
||||||
|
desc t5;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 varbinary(20) YES NULL
|
||||||
|
create table t6 as select coalesce(f2,f3) as f4 from t1;
|
||||||
|
desc t6;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 varbinary(20) YES NULL
|
||||||
|
create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1;
|
||||||
|
desc t7;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 datetime YES NULL
|
||||||
|
create table t8 as select coalesce(cast('01-01-01' as datetime),f2) as f4
|
||||||
|
from t1;
|
||||||
|
desc t8;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 datetime YES NULL
|
||||||
|
create table t9 as select case when 1 then cast('01-01-01' as date)
|
||||||
|
when 0 then cast('01-01-01' as date) end as f4 from t1;
|
||||||
|
desc t9;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 date YES NULL
|
||||||
|
create table t10 as select case when 1 then cast('01-01-01' as datetime)
|
||||||
|
when 0 then cast('01-01-01' as datetime) end as f4 from t1;
|
||||||
|
desc t10;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 datetime YES NULL
|
||||||
|
create table t11 as select if(1, cast('01-01-01' as datetime),
|
||||||
|
cast('01-01-01' as date)) as f4 from t1;
|
||||||
|
desc t11;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 datetime YES NULL
|
||||||
|
create table t12 as select least(cast('01-01-01' as datetime),
|
||||||
|
cast('01-01-01' as date)) as f4 from t1;
|
||||||
|
desc t12;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 datetime YES NULL
|
||||||
|
create table t13 as select ifnull(cast('01-01-01' as datetime),
|
||||||
|
cast('01-01-01' as date)) as f4 from t1;
|
||||||
|
desc t13;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f4 datetime YES NULL
|
||||||
|
drop tables t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13;
|
||||||
|
###################################################################
|
||||||
set @org_mode=@@sql_mode;
|
set @org_mode=@@sql_mode;
|
||||||
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
|
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
|
||||||
Warnings:
|
Warnings:
|
||||||
|
@ -625,7 +625,7 @@ drop table t1;
|
|||||||
create table t1 (a int, b int);
|
create table t1 (a int, b int);
|
||||||
create view v1 as select a, sum(b) from t1 group by a;
|
create view v1 as select a, sum(b) from t1 group by a;
|
||||||
select b from v1 use index (some_index) where b=1;
|
select b from v1 use index (some_index) where b=1;
|
||||||
ERROR 42000: Key 'some_index' doesn't exist in table 'v1'
|
ERROR HY000: Incorrect usage of index hints and VIEW
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (col1 char(5),col2 char(5));
|
create table t1 (col1 char(5),col2 char(5));
|
||||||
@ -2701,27 +2701,26 @@ CREATE TABLE t1(
|
|||||||
fName varchar(25) NOT NULL,
|
fName varchar(25) NOT NULL,
|
||||||
lName varchar(25) NOT NULL,
|
lName varchar(25) NOT NULL,
|
||||||
DOB date NOT NULL,
|
DOB date NOT NULL,
|
||||||
|
test_date date NOT NULL,
|
||||||
uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
|
uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
|
||||||
INSERT INTO t1(fName, lName, DOB) VALUES
|
INSERT INTO t1(fName, lName, DOB, test_date) VALUES
|
||||||
('Hank', 'Hill', '1964-09-29'),
|
('Hank', 'Hill', '1964-09-29', '2007-01-01'),
|
||||||
('Tom', 'Adams', '1908-02-14'),
|
('Tom', 'Adams', '1908-02-14', '2007-01-01'),
|
||||||
('Homer', 'Simpson', '1968-03-05');
|
('Homer', 'Simpson', '1968-03-05', '2007-01-01');
|
||||||
CREATE VIEW v1 AS
|
CREATE VIEW v1 AS
|
||||||
SELECT (year(now())-year(DOB)) AS Age
|
SELECT (year(test_date)-year(DOB)) AS Age
|
||||||
FROM t1 HAVING Age < 75;
|
FROM t1 HAVING Age < 75;
|
||||||
SHOW CREATE VIEW v1;
|
SHOW CREATE VIEW v1;
|
||||||
View Create View character_set_client collation_connection
|
View Create View character_set_client collation_connection
|
||||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75) latin1 latin1_swedish_ci
|
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(`t1`.`test_date`) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75) latin1 latin1_swedish_ci
|
||||||
set timestamp=1136066400;
|
SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75;
|
||||||
SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
|
|
||||||
Age
|
Age
|
||||||
42
|
43
|
||||||
38
|
39
|
||||||
set timestamp=1136066400;
|
|
||||||
SELECT * FROM v1;
|
SELECT * FROM v1;
|
||||||
Age
|
Age
|
||||||
42
|
43
|
||||||
38
|
39
|
||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a char(6) DEFAULT 'xxx');
|
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a char(6) DEFAULT 'xxx');
|
||||||
@ -3559,6 +3558,45 @@ table_name is_updatable
|
|||||||
v1 NO
|
v1 NO
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||||
|
SELECT * FROM v1 USE KEY(non_existant);
|
||||||
|
ERROR HY000: Incorrect usage of index hints and VIEW
|
||||||
|
SELECT * FROM v1 FORCE KEY(non_existant);
|
||||||
|
ERROR HY000: Incorrect usage of index hints and VIEW
|
||||||
|
SELECT * FROM v1 IGNORE KEY(non_existant);
|
||||||
|
ERROR HY000: Incorrect usage of index hints and VIEW
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY(a), KEY (b));
|
||||||
|
INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),();
|
||||||
|
CREATE VIEW v1 AS SELECT * FROM t1 FORCE KEY (PRIMARY,b) ORDER BY a;
|
||||||
|
SHOW CREATE VIEW v1;
|
||||||
|
View Create View character_set_client collation_connection
|
||||||
|
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` FORCE INDEX (PRIMARY) FORCE INDEX (`b`) order by `t1`.`a` latin1 latin1_swedish_ci
|
||||||
|
EXPLAIN SELECT * FROM v1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 index NULL PRIMARY 4 NULL 15
|
||||||
|
CREATE VIEW v2 AS SELECT * FROM t1 USE KEY () ORDER BY a;
|
||||||
|
SHOW CREATE VIEW v2;
|
||||||
|
View Create View character_set_client collation_connection
|
||||||
|
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` USE INDEX () order by `t1`.`a` latin1 latin1_swedish_ci
|
||||||
|
EXPLAIN SELECT * FROM v2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort
|
||||||
|
CREATE VIEW v3 AS SELECT * FROM t1 IGNORE KEY (b) ORDER BY a;
|
||||||
|
SHOW CREATE VIEW v3;
|
||||||
|
View Create View character_set_client collation_connection
|
||||||
|
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` IGNORE INDEX (`b`) order by `t1`.`a` latin1 latin1_swedish_ci
|
||||||
|
EXPLAIN SELECT * FROM v3;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP VIEW v2;
|
||||||
|
DROP VIEW v3;
|
||||||
|
DROP TABLE t1;
|
||||||
End of 5.0 tests.
|
End of 5.0 tests.
|
||||||
DROP DATABASE IF EXISTS `d-1`;
|
DROP DATABASE IF EXISTS `d-1`;
|
||||||
CREATE DATABASE `d-1`;
|
CREATE DATABASE `d-1`;
|
||||||
|
@ -778,15 +778,60 @@ GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost;
|
|||||||
GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost;
|
GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost;
|
||||||
GRANT SELECT ON db26813.t1 TO u26813@localhost;
|
GRANT SELECT ON db26813.t1 TO u26813@localhost;
|
||||||
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||||
ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table 'v1'
|
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||||
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||||
ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2'
|
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||||
ALTER VIEW v3 AS SELECT f2 FROM t1;
|
ALTER VIEW v3 AS SELECT f2 FROM t1;
|
||||||
|
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||||
SHOW CREATE VIEW v3;
|
SHOW CREATE VIEW v3;
|
||||||
View Create View character_set_client collation_connection
|
View Create View character_set_client collation_connection
|
||||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci
|
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
|
||||||
DROP USER u26813@localhost;
|
DROP USER u26813@localhost;
|
||||||
DROP DATABASE db26813;
|
DROP DATABASE db26813;
|
||||||
|
#
|
||||||
|
# Bug#29908: A user can gain additional access through the ALTER VIEW.
|
||||||
|
#
|
||||||
|
CREATE DATABASE mysqltest_29908;
|
||||||
|
USE mysqltest_29908;
|
||||||
|
CREATE TABLE t1(f1 INT, f2 INT);
|
||||||
|
CREATE USER u29908_1@localhost;
|
||||||
|
CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1;
|
||||||
|
CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS
|
||||||
|
SELECT f1 FROM t1;
|
||||||
|
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost;
|
||||||
|
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost;
|
||||||
|
GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost;
|
||||||
|
CREATE USER u29908_2@localhost;
|
||||||
|
GRANT DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
|
||||||
|
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
|
||||||
|
GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost;
|
||||||
|
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||||
|
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||||
|
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||||
|
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||||
|
SHOW CREATE VIEW v2;
|
||||||
|
View Create View character_set_client collation_connection
|
||||||
|
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
|
||||||
|
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||||
|
SHOW CREATE VIEW v1;
|
||||||
|
View Create View character_set_client collation_connection
|
||||||
|
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci
|
||||||
|
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||||
|
SHOW CREATE VIEW v2;
|
||||||
|
View Create View character_set_client collation_connection
|
||||||
|
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci
|
||||||
|
ALTER VIEW v1 AS SELECT f1 FROM t1;
|
||||||
|
SHOW CREATE VIEW v1;
|
||||||
|
View Create View character_set_client collation_connection
|
||||||
|
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
|
||||||
|
ALTER VIEW v2 AS SELECT f1 FROM t1;
|
||||||
|
SHOW CREATE VIEW v2;
|
||||||
|
View Create View character_set_client collation_connection
|
||||||
|
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
|
||||||
|
DROP USER u29908_1@localhost;
|
||||||
|
DROP USER u29908_2@localhost;
|
||||||
|
DROP DATABASE mysqltest_29908;
|
||||||
|
#######################################################################
|
||||||
DROP DATABASE IF EXISTS mysqltest1;
|
DROP DATABASE IF EXISTS mysqltest1;
|
||||||
DROP DATABASE IF EXISTS mysqltest2;
|
DROP DATABASE IF EXISTS mysqltest2;
|
||||||
CREATE DATABASE mysqltest1;
|
CREATE DATABASE mysqltest1;
|
||||||
@ -893,6 +938,8 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VI
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||||
ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
|
ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
|
||||||
|
Warnings:
|
||||||
|
Note 1449 There is no 'no_such'@'user_1' registered
|
||||||
SHOW CREATE VIEW v1;
|
SHOW CREATE VIEW v1;
|
||||||
View Create View character_set_client collation_connection
|
View Create View character_set_client collation_connection
|
||||||
v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
|
v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
|
||||||
|
@ -4,6 +4,13 @@ reset master;
|
|||||||
reset slave;
|
reset slave;
|
||||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||||
start slave;
|
start slave;
|
||||||
|
show variables like 'relay_log%';
|
||||||
|
Variable_name Value
|
||||||
|
relay_log MYSQLTEST_VARDIR/master-data/relay-log
|
||||||
|
relay_log_index
|
||||||
|
relay_log_info_file relay-log.info
|
||||||
|
relay_log_purge ON
|
||||||
|
relay_log_space_limit 0
|
||||||
stop slave;
|
stop slave;
|
||||||
change master to master_host='127.0.0.1',master_user='root',
|
change master to master_host='127.0.0.1',master_user='root',
|
||||||
master_password='',master_port=MASTER_PORT;
|
master_password='',master_port=MASTER_PORT;
|
||||||
|
@ -2,12 +2,9 @@
|
|||||||
# in case of bi-directional replication
|
# in case of bi-directional replication
|
||||||
-- source include/master-slave.inc
|
-- source include/master-slave.inc
|
||||||
|
|
||||||
#
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
# Start replication master -> slave
|
show variables like 'relay_log%';
|
||||||
#
|
|
||||||
# We have to sync with master, to ensure slave had time to start properly
|
|
||||||
# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
|
|
||||||
sync_slave_with_master;
|
|
||||||
connection slave;
|
connection slave;
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
stop slave;
|
stop slave;
|
||||||
|
@ -408,5 +408,13 @@ select f2 from t2 where f2 in (1,'b');
|
|||||||
explain select f2 from t2 where f2 in (1,'b');
|
explain select f2 from t2 where f2 in (1,'b');
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #31075: crash in get_func_mm_tree
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (a time, key(a));
|
||||||
|
insert into t1 values (),(),(),(),(),(),(),(),(),();
|
||||||
|
select a from t1 where a not in (a,a,a) group by a;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
@ -224,4 +224,29 @@ select mod(cast(-2 as unsigned), 3), mod(18446744073709551614, 3), mod(-2, 3);
|
|||||||
select mod(5, cast(-2 as unsigned)), mod(5, 18446744073709551614), mod(5, -2);
|
select mod(5, cast(-2 as unsigned)), mod(5, 18446744073709551614), mod(5, -2);
|
||||||
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
|
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #30587: mysql crashes when trying to group by TIME div NUMBER
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
|
||||||
|
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
|
||||||
|
SELECT a DIV 900 y FROM t1 GROUP BY y;
|
||||||
|
SELECT DISTINCT a DIV 900 y FROM t1;
|
||||||
|
SELECT b DIV 900 y FROM t1 GROUP BY y;
|
||||||
|
SELECT c DIV 900 y FROM t1 GROUP BY y;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
CREATE TABLE t1(a LONGBLOB);
|
||||||
|
INSERT INTO t1 VALUES('1'),('2'),('3');
|
||||||
|
SELECT DISTINCT (a DIV 254576881) FROM t1;
|
||||||
|
SELECT (a DIV 254576881) FROM t1 UNION ALL
|
||||||
|
SELECT (a DIV 254576881) FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
CREATE TABLE t1(a SET('a','b','c'));
|
||||||
|
INSERT INTO t1 VALUES ('a');
|
||||||
|
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
@ -198,6 +198,21 @@ drop table table_26093;
|
|||||||
drop function func_26093_a;
|
drop function func_26093_a;
|
||||||
drop function func_26093_b;
|
drop function func_26093_b;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #30832: Assertion + crash with select name_const('test',now());
|
||||||
|
#
|
||||||
|
--error ER_WRONG_ARGUMENTS
|
||||||
|
SELECT NAME_CONST('test', NOW());
|
||||||
|
--error ER_WRONG_ARGUMENTS
|
||||||
|
SELECT NAME_CONST('test', UPPER('test'));
|
||||||
|
|
||||||
|
SELECT NAME_CONST('test', NULL);
|
||||||
|
SELECT NAME_CONST('test', 1);
|
||||||
|
SELECT NAME_CONST('test', -1);
|
||||||
|
SELECT NAME_CONST('test', 1.0);
|
||||||
|
SELECT NAME_CONST('test', -1.0);
|
||||||
|
SELECT NAME_CONST('test', 'test');
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -547,6 +547,16 @@ DROP TABLE testBug8868;
|
|||||||
|
|
||||||
SET NAMES DEFAULT;
|
SET NAMES DEFAULT;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #31160: MAKETIME() crashes server when returning NULL in ORDER BY using
|
||||||
|
# filesort
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a TIMESTAMP
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES (now()), (now());
|
||||||
|
SELECT 1 FROM t1 ORDER BY MAKETIME(1, 1, a);
|
||||||
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug #19844 time_format in Union truncates values
|
# Bug #19844 time_format in Union truncates values
|
||||||
#
|
#
|
||||||
|
@ -797,6 +797,42 @@ UPDATE t1 set spatial_point=GeomFromText('POINT(41 46)') where c1 like 'f%';
|
|||||||
CHECK TABLE t1 EXTENDED;
|
CHECK TABLE t1 EXTENDED;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #30286 spatial index cause corruption and server crash!
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (a geometry not null, spatial index(a));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
|
||||||
|
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -432,6 +432,14 @@ INSERT INTO t1 VALUES (NULL);
|
|||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #30955 geomfromtext() crasher
|
||||||
|
#
|
||||||
|
CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
|
||||||
|
INSERT INTO `t1` VALUES ('','0000-00-00');
|
||||||
|
select geomfromtext(col9,col89) as a from t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo End of 4.1 tests
|
--echo End of 4.1 tests
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -585,5 +585,37 @@ drop user mysqltest_1@localhost;
|
|||||||
drop user mysqltest_2@localhost;
|
drop user mysqltest_2@localhost;
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #30468: column level privileges not respected when joining tables
|
||||||
|
#
|
||||||
|
CREATE DATABASE db1;
|
||||||
|
|
||||||
|
USE db1;
|
||||||
|
CREATE TABLE t1 (a INT, b INT);
|
||||||
|
INSERT INTO t1 VALUES (1,1),(2,2);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (b INT, c INT);
|
||||||
|
INSERT INTO t2 VALUES (1,100),(2,200);
|
||||||
|
|
||||||
|
GRANT SELECT ON t1 TO mysqltest1@localhost;
|
||||||
|
GRANT SELECT (b) ON t2 TO mysqltest1@localhost;
|
||||||
|
|
||||||
|
connect (conn1,localhost,mysqltest1,,);
|
||||||
|
connection conn1;
|
||||||
|
USE db1;
|
||||||
|
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||||
|
SELECT c FROM t2;
|
||||||
|
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||||
|
SELECT * FROM t2;
|
||||||
|
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||||
|
SELECT * FROM t1 JOIN t2 USING (b);
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
disconnect conn1;
|
||||||
|
DROP TABLE db1.t1, db1.t2;
|
||||||
|
DROP USER mysqltest1@localhost;
|
||||||
|
DROP DATABASE db1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
@ -811,6 +811,7 @@ EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY,i2);
|
|||||||
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2);
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2);
|
||||||
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
|
||||||
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
|
||||||
|
SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
|
||||||
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY)
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY)
|
||||||
IGNORE INDEX FOR GROUP BY (i2) GROUP BY a;
|
IGNORE INDEX FOR GROUP BY (i2) GROUP BY a;
|
||||||
EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY) IGNORE INDEX FOR ORDER BY (i2);
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY) IGNORE INDEX FOR ORDER BY (i2);
|
||||||
|
@ -1090,6 +1090,14 @@ show columns from t1;
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
--echo End of 5.0 tests.
|
--echo End of 5.0 tests.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#30079 A check for "hidden" I_S tables is flawed
|
||||||
|
#
|
||||||
|
--error 1109
|
||||||
|
show fields from information_schema.table_names;
|
||||||
|
--error 1109
|
||||||
|
show keys from information_schema.table_names;
|
||||||
#
|
#
|
||||||
# Show engines
|
# Show engines
|
||||||
#
|
#
|
||||||
@ -1178,4 +1186,20 @@ select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysql' AND TA
|
|||||||
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysql' AND TABLE_NAME='';
|
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysql' AND TABLE_NAME='';
|
||||||
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='';
|
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='';
|
||||||
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='nonexisting';
|
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='nonexisting';
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#30689 Wrong content in I_S.VIEWS.VIEW_DEFINITION if VIEW is based on I_S
|
||||||
|
#
|
||||||
|
CREATE VIEW v1
|
||||||
|
AS SELECT *
|
||||||
|
FROM INFORMATION_SCHEMA.TABLES;
|
||||||
|
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS where TABLE_NAME = 'v1';
|
||||||
|
DROP VIEW v1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#30795 Query on INFORMATION_SCHEMA.SCHEMATA, wrong result
|
||||||
|
#
|
||||||
|
SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA
|
||||||
|
WHERE SCHEMA_NAME ='information_schema';
|
||||||
|
|
||||||
--echo End of 5.1 tests.
|
--echo End of 5.1 tests.
|
||||||
|
@ -372,3 +372,15 @@ INSERT INTO t1 (prev_id) SELECT id
|
|||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
|
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#30384: Having SQL_BUFFER_RESULT option in the
|
||||||
|
--echo # CREATE .. KEY(..) .. SELECT led to creating corrupted index.
|
||||||
|
--echo #
|
||||||
|
create table t1(f1 int);
|
||||||
|
insert into t1 values(1),(2),(3);
|
||||||
|
create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
|
||||||
|
check table t2 extended;
|
||||||
|
drop table t1,t2;
|
||||||
|
--echo ##################################################################
|
||||||
|
|
||||||
|
@ -698,4 +698,33 @@ select '^^: The above should be ~= 20 + cost(select * from t1). Value less than
|
|||||||
|
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #31094: Forcing index-based sort doesn't work anymore if joins are
|
||||||
|
# done
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
|
||||||
|
CREATE TABLE t2 (c INT PRIMARY KEY, d INT);
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES(1,NULL),(2,NULL),(3,NULL),(4,NULL);
|
||||||
|
INSERT INTO t1 SELECT a + 4, b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a + 8, b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a + 16, b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a + 32, b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a + 64, b FROM t1;
|
||||||
|
INSERT INTO t2 SELECT a, b FROM t1;
|
||||||
|
|
||||||
|
#expect indexed ORDER BY
|
||||||
|
EXPLAIN SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a LIMIT 2;
|
||||||
|
EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2;
|
||||||
|
SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a LIMIT 2;
|
||||||
|
SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2;
|
||||||
|
|
||||||
|
#expect filesort
|
||||||
|
EXPLAIN SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a;
|
||||||
|
EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
|
||||||
|
SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a;
|
||||||
|
SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS t1,t2;
|
||||||
--echo End of 5.0 tests.
|
--echo End of 5.0 tests.
|
||||||
|
@ -1576,6 +1576,23 @@ SELECT * FROM t2;
|
|||||||
|
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#29815: new option for suppressing last line of mysqldump:
|
||||||
|
--echo # "Dump completed on"
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--echo # --skip-dump-date:
|
||||||
|
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*//
|
||||||
|
--exec $MYSQL_DUMP --skip-dump-date test
|
||||||
|
|
||||||
|
--echo # --dump-date:
|
||||||
|
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/
|
||||||
|
--exec $MYSQL_DUMP --dump-date test
|
||||||
|
|
||||||
|
--echo # --dump-date (default):
|
||||||
|
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/
|
||||||
|
--exec $MYSQL_DUMP test
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 5.0 tests
|
--echo # End of 5.0 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -40,3 +40,16 @@
|
|||||||
--exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam" --post-query="SHOW TABLES" --pre-query="SHOW TABLES" --number-of-queries=6 --commit=1;
|
--exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam" --post-query="SHOW TABLES" --pre-query="SHOW TABLES" --number-of-queries=6 --commit=1;
|
||||||
|
|
||||||
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write --detach=2
|
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write --detach=2
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #29985: mysqlslap -- improper handling of resultsets in SPROCs
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP PROCEDURE IF EXISTS p1;
|
||||||
|
--enable_warnings
|
||||||
|
CREATE PROCEDURE p1() SELECT 1;
|
||||||
|
|
||||||
|
--exec $MYSQL_SLAP --create-schema=test --delimiter=";" --query="CALL p1; SELECT 1;" --silent 2>&1
|
||||||
|
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
@ -358,3 +358,12 @@ SELECT * FROM (SELECT a, SUM(a) FROM t1 GROUP BY a WITH ROLLUP) as t;
|
|||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#31095: Unexpected NULL constant caused server crash.
|
||||||
|
--echo #
|
||||||
|
create table t1(a int);
|
||||||
|
insert into t1 values (1),(2),(3);
|
||||||
|
select count(a) from t1 group by null with rollup;
|
||||||
|
drop table t1;
|
||||||
|
--echo ##############################################################
|
||||||
|
|
||||||
|
@ -779,3 +779,60 @@ EXPLAIN SELECT id,c3 FROM t2 WHERE c2 BETWEEN 20 AND 30 ORDER BY c3 LIMIT 4000;
|
|||||||
SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 20;
|
SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 20;
|
||||||
|
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #30665: Inconsistent optimization of IGNORE INDEX FOR {ORDER BY|GROUP BY}
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a INT,
|
||||||
|
b INT,
|
||||||
|
PRIMARY KEY (a),
|
||||||
|
KEY ab(a, b)
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
|
||||||
|
INSERT INTO t1 SELECT a + 4, b + 4 FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a + 8, b + 8 FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a +16, b +16 FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a +32, b +32 FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a +64, b +64 FROM t1;
|
||||||
|
|
||||||
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a;
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--let $q = `show status like 'Created_tmp_tables';`
|
||||||
|
eval set @tmp_tables_before =
|
||||||
|
CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED);
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
|
SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a;
|
||||||
|
|
||||||
|
# this query creates one temporary table in itself, which we are not
|
||||||
|
# interested in.
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--let $q = `show status like 'Created_tmp_tables';`
|
||||||
|
eval set @tmp_tables_after =
|
||||||
|
CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED);
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
|
SELECT @tmp_tables_after = @tmp_tables_before ;
|
||||||
|
|
||||||
|
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a;
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--let $q = `show status like 'Created_tmp_tables';`
|
||||||
|
eval set @tmp_tables_before =
|
||||||
|
CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED);
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
|
SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a;
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--let $q = `show status like 'Created_tmp_tables';`
|
||||||
|
eval set @tmp_tables_after =
|
||||||
|
CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED);
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
|
SELECT @tmp_tables_after = @tmp_tables_before;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -139,3 +139,16 @@ insert into t1 values (9912101,9912101,9912101);
|
|||||||
insert into t1 values (11111,11111,11111);
|
insert into t1 values (11111,11111,11111);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #30942: select str_to_date from derived table returns varying results
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a INT
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
INSERT INTO t1 VALUES (NULL);
|
||||||
|
|
||||||
|
SELECT str_to_date( '', a ) FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -283,6 +283,43 @@ select * from t1 where f1 between 2002010 and 20070101000000;
|
|||||||
select * from t1 where f1 between 20020101 and 2007010100000;
|
select * from t1 where f1 between 20020101 and 2007010100000;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#27216: functions with parameters of different date types may
|
||||||
|
--echo # return wrong type of the result.
|
||||||
|
--echo #
|
||||||
|
create table t1 (f1 date, f2 datetime, f3 varchar(20));
|
||||||
|
create table t2 as select coalesce(f1,f1) as f4 from t1;
|
||||||
|
desc t2;
|
||||||
|
create table t3 as select coalesce(f1,f2) as f4 from t1;
|
||||||
|
desc t3;
|
||||||
|
create table t4 as select coalesce(f2,f2) as f4 from t1;
|
||||||
|
desc t4;
|
||||||
|
create table t5 as select coalesce(f1,f3) as f4 from t1;
|
||||||
|
desc t5;
|
||||||
|
create table t6 as select coalesce(f2,f3) as f4 from t1;
|
||||||
|
desc t6;
|
||||||
|
create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1;
|
||||||
|
desc t7;
|
||||||
|
create table t8 as select coalesce(cast('01-01-01' as datetime),f2) as f4
|
||||||
|
from t1;
|
||||||
|
desc t8;
|
||||||
|
create table t9 as select case when 1 then cast('01-01-01' as date)
|
||||||
|
when 0 then cast('01-01-01' as date) end as f4 from t1;
|
||||||
|
desc t9;
|
||||||
|
create table t10 as select case when 1 then cast('01-01-01' as datetime)
|
||||||
|
when 0 then cast('01-01-01' as datetime) end as f4 from t1;
|
||||||
|
desc t10;
|
||||||
|
create table t11 as select if(1, cast('01-01-01' as datetime),
|
||||||
|
cast('01-01-01' as date)) as f4 from t1;
|
||||||
|
desc t11;
|
||||||
|
create table t12 as select least(cast('01-01-01' as datetime),
|
||||||
|
cast('01-01-01' as date)) as f4 from t1;
|
||||||
|
desc t12;
|
||||||
|
create table t13 as select ifnull(cast('01-01-01' as datetime),
|
||||||
|
cast('01-01-01' as date)) as f4 from t1;
|
||||||
|
desc t13;
|
||||||
|
drop tables t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13;
|
||||||
|
--echo ###################################################################
|
||||||
#
|
#
|
||||||
# Test of storing datetime into date fields
|
# Test of storing datetime into date fields
|
||||||
#
|
#
|
||||||
|
@ -510,7 +510,7 @@ drop table t1;
|
|||||||
#
|
#
|
||||||
create table t1 (a int, b int);
|
create table t1 (a int, b int);
|
||||||
create view v1 as select a, sum(b) from t1 group by a;
|
create view v1 as select a, sum(b) from t1 group by a;
|
||||||
-- error 1176
|
--error ER_WRONG_USAGE
|
||||||
select b from v1 use index (some_index) where b=1;
|
select b from v1 use index (some_index) where b=1;
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
@ -2549,21 +2549,20 @@ CREATE TABLE t1(
|
|||||||
fName varchar(25) NOT NULL,
|
fName varchar(25) NOT NULL,
|
||||||
lName varchar(25) NOT NULL,
|
lName varchar(25) NOT NULL,
|
||||||
DOB date NOT NULL,
|
DOB date NOT NULL,
|
||||||
|
test_date date NOT NULL,
|
||||||
uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
|
uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
|
||||||
|
|
||||||
INSERT INTO t1(fName, lName, DOB) VALUES
|
INSERT INTO t1(fName, lName, DOB, test_date) VALUES
|
||||||
('Hank', 'Hill', '1964-09-29'),
|
('Hank', 'Hill', '1964-09-29', '2007-01-01'),
|
||||||
('Tom', 'Adams', '1908-02-14'),
|
('Tom', 'Adams', '1908-02-14', '2007-01-01'),
|
||||||
('Homer', 'Simpson', '1968-03-05');
|
('Homer', 'Simpson', '1968-03-05', '2007-01-01');
|
||||||
|
|
||||||
CREATE VIEW v1 AS
|
CREATE VIEW v1 AS
|
||||||
SELECT (year(now())-year(DOB)) AS Age
|
SELECT (year(test_date)-year(DOB)) AS Age
|
||||||
FROM t1 HAVING Age < 75;
|
FROM t1 HAVING Age < 75;
|
||||||
SHOW CREATE VIEW v1;
|
SHOW CREATE VIEW v1;
|
||||||
|
|
||||||
set timestamp=1136066400;
|
SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75;
|
||||||
SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
|
|
||||||
set timestamp=1136066400;
|
|
||||||
SELECT * FROM v1;
|
SELECT * FROM v1;
|
||||||
|
|
||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
@ -3415,6 +3414,46 @@ select table_name, is_updatable from information_schema.views
|
|||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #28701: SELECTs from VIEWs completely ignore USE/FORCE KEY, allowing
|
||||||
|
# invalid statements
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||||
|
--error ER_WRONG_USAGE
|
||||||
|
SELECT * FROM v1 USE KEY(non_existant);
|
||||||
|
--error ER_WRONG_USAGE
|
||||||
|
SELECT * FROM v1 FORCE KEY(non_existant);
|
||||||
|
--error ER_WRONG_USAGE
|
||||||
|
SELECT * FROM v1 IGNORE KEY(non_existant);
|
||||||
|
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #28702: VIEWs defined with USE/FORCE KEY ignore that request
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY(a), KEY (b));
|
||||||
|
INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),();
|
||||||
|
CREATE VIEW v1 AS SELECT * FROM t1 FORCE KEY (PRIMARY,b) ORDER BY a;
|
||||||
|
SHOW CREATE VIEW v1;
|
||||||
|
EXPLAIN SELECT * FROM v1;
|
||||||
|
CREATE VIEW v2 AS SELECT * FROM t1 USE KEY () ORDER BY a;
|
||||||
|
SHOW CREATE VIEW v2;
|
||||||
|
EXPLAIN SELECT * FROM v2;
|
||||||
|
CREATE VIEW v3 AS SELECT * FROM t1 IGNORE KEY (b) ORDER BY a;
|
||||||
|
SHOW CREATE VIEW v3;
|
||||||
|
EXPLAIN SELECT * FROM v3;
|
||||||
|
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP VIEW v2;
|
||||||
|
DROP VIEW v3;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.0 tests.
|
--echo End of 5.0 tests.
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1040,10 +1040,11 @@ GRANT SELECT ON db26813.t1 TO u26813@localhost;
|
|||||||
|
|
||||||
connect (u1,localhost,u26813,,db26813);
|
connect (u1,localhost,u26813,,db26813);
|
||||||
connection u1;
|
connection u1;
|
||||||
--error 1142
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||||
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||||
--error 1142
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||||
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||||
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||||
ALTER VIEW v3 AS SELECT f2 FROM t1;
|
ALTER VIEW v3 AS SELECT f2 FROM t1;
|
||||||
|
|
||||||
connection root;
|
connection root;
|
||||||
@ -1053,6 +1054,51 @@ DROP USER u26813@localhost;
|
|||||||
DROP DATABASE db26813;
|
DROP DATABASE db26813;
|
||||||
disconnect u1;
|
disconnect u1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#29908: A user can gain additional access through the ALTER VIEW.
|
||||||
|
--echo #
|
||||||
|
connection root;
|
||||||
|
CREATE DATABASE mysqltest_29908;
|
||||||
|
USE mysqltest_29908;
|
||||||
|
CREATE TABLE t1(f1 INT, f2 INT);
|
||||||
|
CREATE USER u29908_1@localhost;
|
||||||
|
CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1;
|
||||||
|
CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS
|
||||||
|
SELECT f1 FROM t1;
|
||||||
|
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost;
|
||||||
|
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost;
|
||||||
|
GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost;
|
||||||
|
CREATE USER u29908_2@localhost;
|
||||||
|
GRANT DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
|
||||||
|
GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
|
||||||
|
GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost;
|
||||||
|
|
||||||
|
connect (u2,localhost,u29908_2,,mysqltest_29908);
|
||||||
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||||
|
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||||
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||||
|
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||||
|
SHOW CREATE VIEW v2;
|
||||||
|
|
||||||
|
connect (u1,localhost,u29908_1,,mysqltest_29908);
|
||||||
|
ALTER VIEW v1 AS SELECT f2 FROM t1;
|
||||||
|
SHOW CREATE VIEW v1;
|
||||||
|
ALTER VIEW v2 AS SELECT f2 FROM t1;
|
||||||
|
SHOW CREATE VIEW v2;
|
||||||
|
|
||||||
|
connection root;
|
||||||
|
ALTER VIEW v1 AS SELECT f1 FROM t1;
|
||||||
|
SHOW CREATE VIEW v1;
|
||||||
|
ALTER VIEW v2 AS SELECT f1 FROM t1;
|
||||||
|
SHOW CREATE VIEW v2;
|
||||||
|
|
||||||
|
DROP USER u29908_1@localhost;
|
||||||
|
DROP USER u29908_2@localhost;
|
||||||
|
DROP DATABASE mysqltest_29908;
|
||||||
|
disconnect u1;
|
||||||
|
disconnect u2;
|
||||||
|
--echo #######################################################################
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#24040: Create View don't succed with "all privileges" on a database.
|
# BUG#24040: Create View don't succed with "all privileges" on a database.
|
||||||
#
|
#
|
||||||
|
15
sql/field.cc
15
sql/field.cc
@ -1457,15 +1457,24 @@ void Field_num::add_zerofill_and_unsigned(String &res) const
|
|||||||
|
|
||||||
void Field::make_field(Send_field *field)
|
void Field::make_field(Send_field *field)
|
||||||
{
|
{
|
||||||
if (orig_table->s->db.str && *orig_table->s->db.str)
|
if (orig_table && orig_table->s->db.str && *orig_table->s->db.str)
|
||||||
{
|
{
|
||||||
field->db_name= orig_table->s->db.str;
|
field->db_name= orig_table->s->db.str;
|
||||||
field->org_table_name= orig_table->s->table_name.str;
|
field->org_table_name= orig_table->s->table_name.str;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
field->org_table_name= field->db_name= "";
|
field->org_table_name= field->db_name= "";
|
||||||
field->table_name= orig_table->alias;
|
if (orig_table)
|
||||||
field->col_name= field->org_col_name= field_name;
|
{
|
||||||
|
field->table_name= orig_table->alias;
|
||||||
|
field->org_col_name= field_name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
field->table_name= "";
|
||||||
|
field->org_col_name= "";
|
||||||
|
}
|
||||||
|
field->col_name= field_name;
|
||||||
field->charsetnr= charset()->number;
|
field->charsetnr= charset()->number;
|
||||||
field->length=field_length;
|
field->length=field_length;
|
||||||
field->type=type();
|
field->type=type();
|
||||||
|
@ -44,7 +44,7 @@ bool Gis_read_stream::get_next_word(LEX_STRING *res)
|
|||||||
skip_space();
|
skip_space();
|
||||||
res->str= (char*) m_cur;
|
res->str= (char*) m_cur;
|
||||||
/* The following will also test for \0 */
|
/* The following will also test for \0 */
|
||||||
if (!my_isvar_start(&my_charset_bin, *m_cur))
|
if ((m_cur >= m_limit) || !my_isvar_start(&my_charset_bin, *m_cur))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2924,12 +2924,7 @@ void ha_partition::start_bulk_insert(ha_rows rows)
|
|||||||
handler **file;
|
handler **file;
|
||||||
DBUG_ENTER("ha_partition::start_bulk_insert");
|
DBUG_ENTER("ha_partition::start_bulk_insert");
|
||||||
|
|
||||||
if (!rows)
|
rows= rows ? rows/m_tot_parts + 1 : 0;
|
||||||
{
|
|
||||||
/* Avoid allocation big caches in all underlaying handlers */
|
|
||||||
DBUG_VOID_RETURN;
|
|
||||||
}
|
|
||||||
rows= rows/m_tot_parts + 1;
|
|
||||||
file= m_file;
|
file= m_file;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -3145,6 +3145,8 @@ int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (was_semi_consistent_read())
|
||||||
|
goto scan_it_again;
|
||||||
/*
|
/*
|
||||||
We need to set this for the last range only, but checking this
|
We need to set this for the last range only, but checking this
|
||||||
condition is more expensive than just setting the result code.
|
condition is more expensive than just setting the result code.
|
||||||
@ -3152,10 +3154,10 @@ int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
|
|||||||
result= HA_ERR_END_OF_FILE;
|
result= HA_ERR_END_OF_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
multi_range_curr++;
|
||||||
|
scan_it_again:
|
||||||
/* Try the next range(s) until one matches a record. */
|
/* Try the next range(s) until one matches a record. */
|
||||||
for (multi_range_curr++;
|
for (; multi_range_curr < multi_range_end; multi_range_curr++)
|
||||||
multi_range_curr < multi_range_end;
|
|
||||||
multi_range_curr++)
|
|
||||||
{
|
{
|
||||||
result= read_range_first(multi_range_curr->start_key.keypart_map ?
|
result= read_range_first(multi_range_curr->start_key.keypart_map ?
|
||||||
&multi_range_curr->start_key : 0,
|
&multi_range_curr->start_key : 0,
|
||||||
|
@ -1243,6 +1243,8 @@ public:
|
|||||||
Item_name_const(Item *name_arg, Item *val):
|
Item_name_const(Item *name_arg, Item *val):
|
||||||
value_item(val), name_item(name_arg)
|
value_item(val), name_item(name_arg)
|
||||||
{
|
{
|
||||||
|
if(!value_item->basic_const_item())
|
||||||
|
my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
|
||||||
Item::maybe_null= TRUE;
|
Item::maybe_null= TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,6 +146,35 @@ static int agg_cmp_type(Item_result *type, Item **items, uint nitems)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Aggregates field types from the array of items.
|
||||||
|
|
||||||
|
@param[in] items array of items to aggregate the type from
|
||||||
|
@paran[in] nitems number of items in the array
|
||||||
|
|
||||||
|
@details This function aggregates field types from the array of items.
|
||||||
|
Found type is supposed to be used later as the result field type
|
||||||
|
of a multi-argument function.
|
||||||
|
Aggregation itself is performed by the Field::field_type_merge()
|
||||||
|
function.
|
||||||
|
|
||||||
|
@note The term "aggregation" is used here in the sense of inferring the
|
||||||
|
result type of a function from its argument types.
|
||||||
|
|
||||||
|
@return aggregated field type.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum_field_types agg_field_type(Item **items, uint nitems)
|
||||||
|
{
|
||||||
|
uint i;
|
||||||
|
if (!nitems || items[0]->result_type() == ROW_RESULT )
|
||||||
|
return (enum_field_types)-1;
|
||||||
|
enum_field_types res= items[0]->field_type();
|
||||||
|
for (i= 1 ; i < nitems ; i++)
|
||||||
|
res= Field::field_type_merge(res, items[i]->field_type());
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Collects different types for comparison of first item with each other items
|
Collects different types for comparison of first item with each other items
|
||||||
|
|
||||||
@ -2065,9 +2094,7 @@ Item_func_ifnull::fix_length_and_dec()
|
|||||||
default:
|
default:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
}
|
}
|
||||||
cached_field_type= args[0]->field_type();
|
cached_field_type= agg_field_type(args, 2);
|
||||||
if (cached_field_type != args[1]->field_type())
|
|
||||||
cached_field_type= Item_func::field_type();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2215,11 +2242,13 @@ Item_func_if::fix_length_and_dec()
|
|||||||
{
|
{
|
||||||
cached_result_type= arg2_type;
|
cached_result_type= arg2_type;
|
||||||
collation.set(args[2]->collation.collation);
|
collation.set(args[2]->collation.collation);
|
||||||
|
cached_field_type= args[2]->field_type();
|
||||||
}
|
}
|
||||||
else if (null2)
|
else if (null2)
|
||||||
{
|
{
|
||||||
cached_result_type= arg1_type;
|
cached_result_type= arg1_type;
|
||||||
collation.set(args[1]->collation.collation);
|
collation.set(args[1]->collation.collation);
|
||||||
|
cached_field_type= args[1]->field_type();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2233,6 +2262,7 @@ Item_func_if::fix_length_and_dec()
|
|||||||
{
|
{
|
||||||
collation.set(&my_charset_bin); // Number
|
collation.set(&my_charset_bin); // Number
|
||||||
}
|
}
|
||||||
|
cached_field_type= agg_field_type(args + 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cached_result_type == DECIMAL_RESULT )
|
if ((cached_result_type == DECIMAL_RESULT )
|
||||||
@ -2582,7 +2612,7 @@ void Item_func_case::fix_length_and_dec()
|
|||||||
agg_arg_charsets(collation, agg, nagg, MY_COLL_ALLOW_CONV, 1))
|
agg_arg_charsets(collation, agg, nagg, MY_COLL_ALLOW_CONV, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
cached_field_type= agg_field_type(agg, nagg);
|
||||||
/*
|
/*
|
||||||
Aggregate first expression and all THEN expression types
|
Aggregate first expression and all THEN expression types
|
||||||
and collations when string comparison
|
and collations when string comparison
|
||||||
@ -2751,6 +2781,7 @@ my_decimal *Item_func_coalesce::decimal_op(my_decimal *decimal_value)
|
|||||||
|
|
||||||
void Item_func_coalesce::fix_length_and_dec()
|
void Item_func_coalesce::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
|
cached_field_type= agg_field_type(args, arg_count);
|
||||||
agg_result_type(&hybrid_type, args, arg_count);
|
agg_result_type(&hybrid_type, args, arg_count);
|
||||||
switch (hybrid_type) {
|
switch (hybrid_type) {
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
|
@ -640,6 +640,7 @@ public:
|
|||||||
class Item_func_coalesce :public Item_func_numhybrid
|
class Item_func_coalesce :public Item_func_numhybrid
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
enum_field_types cached_field_type;
|
||||||
Item_func_coalesce(Item *a, Item *b) :Item_func_numhybrid(a, b) {}
|
Item_func_coalesce(Item *a, Item *b) :Item_func_numhybrid(a, b) {}
|
||||||
public:
|
public:
|
||||||
Item_func_coalesce(List<Item> &list) :Item_func_numhybrid(list) {}
|
Item_func_coalesce(List<Item> &list) :Item_func_numhybrid(list) {}
|
||||||
@ -652,13 +653,13 @@ public:
|
|||||||
enum Item_result result_type () const { return hybrid_type; }
|
enum Item_result result_type () const { return hybrid_type; }
|
||||||
const char *func_name() const { return "coalesce"; }
|
const char *func_name() const { return "coalesce"; }
|
||||||
table_map not_null_tables() const { return 0; }
|
table_map not_null_tables() const { return 0; }
|
||||||
|
enum_field_types field_type() const { return cached_field_type; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Item_func_ifnull :public Item_func_coalesce
|
class Item_func_ifnull :public Item_func_coalesce
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
enum_field_types cached_field_type;
|
|
||||||
bool field_type_defined;
|
bool field_type_defined;
|
||||||
public:
|
public:
|
||||||
Item_func_ifnull(Item *a, Item *b) :Item_func_coalesce(a,b) {}
|
Item_func_ifnull(Item *a, Item *b) :Item_func_coalesce(a,b) {}
|
||||||
@ -677,6 +678,7 @@ public:
|
|||||||
class Item_func_if :public Item_func
|
class Item_func_if :public Item_func
|
||||||
{
|
{
|
||||||
enum Item_result cached_result_type;
|
enum Item_result cached_result_type;
|
||||||
|
enum_field_types cached_field_type;
|
||||||
public:
|
public:
|
||||||
Item_func_if(Item *a,Item *b,Item *c)
|
Item_func_if(Item *a,Item *b,Item *c)
|
||||||
:Item_func(a,b,c), cached_result_type(INT_RESULT)
|
:Item_func(a,b,c), cached_result_type(INT_RESULT)
|
||||||
@ -686,6 +688,7 @@ public:
|
|||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
enum Item_result result_type () const { return cached_result_type; }
|
enum Item_result result_type () const { return cached_result_type; }
|
||||||
|
enum_field_types field_type() const { return cached_field_type; }
|
||||||
bool fix_fields(THD *, Item **);
|
bool fix_fields(THD *, Item **);
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
uint decimal_precision() const;
|
uint decimal_precision() const;
|
||||||
@ -713,6 +716,7 @@ public:
|
|||||||
bool is_null();
|
bool is_null();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Functions to handle the optimized IN */
|
/* Functions to handle the optimized IN */
|
||||||
|
|
||||||
|
|
||||||
@ -1104,6 +1108,7 @@ class Item_func_case :public Item_func
|
|||||||
uint ncases;
|
uint ncases;
|
||||||
Item_result cmp_type;
|
Item_result cmp_type;
|
||||||
DTCollation cmp_collation;
|
DTCollation cmp_collation;
|
||||||
|
enum_field_types cached_field_type;
|
||||||
cmp_item *cmp_items[5]; /* For all result types */
|
cmp_item *cmp_items[5]; /* For all result types */
|
||||||
cmp_item *case_item;
|
cmp_item *case_item;
|
||||||
public:
|
public:
|
||||||
@ -1134,6 +1139,7 @@ public:
|
|||||||
uint decimal_precision() const;
|
uint decimal_precision() const;
|
||||||
table_map not_null_tables() const { return 0; }
|
table_map not_null_tables() const { return 0; }
|
||||||
enum Item_result result_type () const { return cached_result_type; }
|
enum Item_result result_type () const { return cached_result_type; }
|
||||||
|
enum_field_types field_type() const { return cached_field_type; }
|
||||||
const char *func_name() const { return "case"; }
|
const char *func_name() const { return "case"; }
|
||||||
void print(String *str);
|
void print(String *str);
|
||||||
Item *find_item(String *str);
|
Item *find_item(String *str);
|
||||||
@ -1442,6 +1448,7 @@ public:
|
|||||||
Item *transform(Item_transformer transformer, uchar *arg);
|
Item *transform(Item_transformer transformer, uchar *arg);
|
||||||
void traverse_cond(Cond_traverser, void *arg, traverse_order order);
|
void traverse_cond(Cond_traverser, void *arg, traverse_order order);
|
||||||
void neg_arguments(THD *thd);
|
void neg_arguments(THD *thd);
|
||||||
|
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||||
bool subst_argument_checker(uchar **arg) { return TRUE; }
|
bool subst_argument_checker(uchar **arg) { return TRUE; }
|
||||||
Item *compile(Item_analyzer analyzer, uchar **arg_p,
|
Item *compile(Item_analyzer analyzer, uchar **arg_p,
|
||||||
Item_transformer transformer, uchar *arg_t);
|
Item_transformer transformer, uchar *arg_t);
|
||||||
|
@ -1377,7 +1377,11 @@ longlong Item_func_int_div::val_int()
|
|||||||
|
|
||||||
void Item_func_int_div::fix_length_and_dec()
|
void Item_func_int_div::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length=args[0]->max_length - args[0]->decimals;
|
Item_result argtype= args[0]->result_type();
|
||||||
|
/* use precision ony for the data type it is applicable for and valid */
|
||||||
|
max_length=args[0]->max_length -
|
||||||
|
(argtype == DECIMAL_RESULT || argtype == INT_RESULT ?
|
||||||
|
args[0]->decimals : 0);
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag;
|
unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag;
|
||||||
}
|
}
|
||||||
@ -2238,6 +2242,7 @@ void Item_func_min_max::fix_length_and_dec()
|
|||||||
else if ((cmp_type == DECIMAL_RESULT) || (cmp_type == INT_RESULT))
|
else if ((cmp_type == DECIMAL_RESULT) || (cmp_type == INT_RESULT))
|
||||||
max_length= my_decimal_precision_to_length(max_int_part+decimals, decimals,
|
max_length= my_decimal_precision_to_length(max_int_part+decimals, decimals,
|
||||||
unsigned_flag);
|
unsigned_flag);
|
||||||
|
cached_field_type= agg_field_type(args, arg_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -436,6 +436,7 @@ public:
|
|||||||
longlong int_op();
|
longlong int_op();
|
||||||
my_decimal *decimal_op(my_decimal *);
|
my_decimal *decimal_op(my_decimal *);
|
||||||
const char *func_name() const { return "-"; }
|
const char *func_name() const { return "-"; }
|
||||||
|
virtual bool basic_const_item() const { return args[0]->basic_const_item(); }
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
void fix_num_length_and_dec();
|
void fix_num_length_and_dec();
|
||||||
uint decimal_precision() const { return args[0]->decimal_precision(); }
|
uint decimal_precision() const { return args[0]->decimal_precision(); }
|
||||||
@ -699,7 +700,8 @@ class Item_func_min_max :public Item_func
|
|||||||
/* An item used for issuing warnings while string to DATETIME conversion. */
|
/* An item used for issuing warnings while string to DATETIME conversion. */
|
||||||
Item *datetime_item;
|
Item *datetime_item;
|
||||||
THD *thd;
|
THD *thd;
|
||||||
|
protected:
|
||||||
|
enum_field_types cached_field_type;
|
||||||
public:
|
public:
|
||||||
Item_func_min_max(List<Item> &list,int cmp_sign_arg) :Item_func(list),
|
Item_func_min_max(List<Item> &list,int cmp_sign_arg) :Item_func(list),
|
||||||
cmp_type(INT_RESULT), cmp_sign(cmp_sign_arg), compare_as_dates(FALSE),
|
cmp_type(INT_RESULT), cmp_sign(cmp_sign_arg), compare_as_dates(FALSE),
|
||||||
@ -712,6 +714,7 @@ public:
|
|||||||
enum Item_result result_type () const { return cmp_type; }
|
enum Item_result result_type () const { return cmp_type; }
|
||||||
bool result_as_longlong() { return compare_as_dates; };
|
bool result_as_longlong() { return compare_as_dates; };
|
||||||
uint cmp_datetimes(ulonglong *value);
|
uint cmp_datetimes(ulonglong *value);
|
||||||
|
enum_field_types field_type() const { return cached_field_type; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Item_func_min :public Item_func_min_max
|
class Item_func_min :public Item_func_min_max
|
||||||
@ -754,6 +757,8 @@ public:
|
|||||||
collation= args[0]->collation;
|
collation= args[0]->collation;
|
||||||
max_length= args[0]->max_length;
|
max_length= args[0]->max_length;
|
||||||
decimals=args[0]->decimals;
|
decimals=args[0]->decimals;
|
||||||
|
/* The item could be a NULL constant. */
|
||||||
|
null_value= args[0]->null_value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3239,7 +3239,7 @@ void Item_func_str_to_date::fix_length_and_dec()
|
|||||||
String format_str(format_buff, sizeof(format_buff), &my_charset_bin), *format;
|
String format_str(format_buff, sizeof(format_buff), &my_charset_bin), *format;
|
||||||
maybe_null= 1;
|
maybe_null= 1;
|
||||||
decimals=0;
|
decimals=0;
|
||||||
cached_field_type= MYSQL_TYPE_STRING;
|
cached_field_type= MYSQL_TYPE_DATETIME;
|
||||||
max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||||
cached_timestamp_type= MYSQL_TIMESTAMP_NONE;
|
cached_timestamp_type= MYSQL_TIMESTAMP_NONE;
|
||||||
format= args[1]->val_str(&format_str);
|
format= args[1]->val_str(&format_str);
|
||||||
|
@ -938,7 +938,10 @@ class Item_func_maketime :public Item_str_timefunc
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Item_func_maketime(Item *a, Item *b, Item *c)
|
Item_func_maketime(Item *a, Item *b, Item *c)
|
||||||
:Item_str_timefunc(a, b ,c) {}
|
:Item_str_timefunc(a, b, c)
|
||||||
|
{
|
||||||
|
maybe_null= TRUE;
|
||||||
|
}
|
||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
const char *func_name() const { return "maketime"; }
|
const char *func_name() const { return "maketime"; }
|
||||||
};
|
};
|
||||||
@ -1007,7 +1010,7 @@ class Item_func_str_to_date :public Item_str_func
|
|||||||
bool const_item;
|
bool const_item;
|
||||||
public:
|
public:
|
||||||
Item_func_str_to_date(Item *a, Item *b)
|
Item_func_str_to_date(Item *a, Item *b)
|
||||||
:Item_str_func(a, b)
|
:Item_str_func(a, b), const_item(false)
|
||||||
{}
|
{}
|
||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
bool get_date(MYSQL_TIME *ltime, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *ltime, uint fuzzy_date);
|
||||||
|
@ -1673,6 +1673,7 @@ void flush_thread_cache();
|
|||||||
|
|
||||||
/* item_func.cc */
|
/* item_func.cc */
|
||||||
extern bool check_reserved_words(LEX_STRING *name);
|
extern bool check_reserved_words(LEX_STRING *name);
|
||||||
|
extern enum_field_types agg_field_type(Item **items, uint nitems);
|
||||||
|
|
||||||
/* strfunc.cc */
|
/* strfunc.cc */
|
||||||
ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs,
|
ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs,
|
||||||
|
@ -5053,7 +5053,7 @@ static SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, Item_func *cond_func,
|
|||||||
|
|
||||||
if (inv)
|
if (inv)
|
||||||
{
|
{
|
||||||
if (func->array->result_type() != ROW_RESULT)
|
if (func->array && func->array->result_type() != ROW_RESULT)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
We get here for conditions in form "t.key NOT IN (c1, c2, ...)",
|
We get here for conditions in form "t.key NOT IN (c1, c2, ...)",
|
||||||
|
@ -827,6 +827,7 @@ bool Protocol_text::store(const char *from, size_t length,
|
|||||||
field_types[field_pos] == MYSQL_TYPE_DECIMAL ||
|
field_types[field_pos] == MYSQL_TYPE_DECIMAL ||
|
||||||
field_types[field_pos] == MYSQL_TYPE_BIT ||
|
field_types[field_pos] == MYSQL_TYPE_BIT ||
|
||||||
field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL ||
|
field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL ||
|
||||||
|
field_types[field_pos] == MYSQL_TYPE_NEWDATE ||
|
||||||
(field_types[field_pos] >= MYSQL_TYPE_ENUM &&
|
(field_types[field_pos] >= MYSQL_TYPE_ENUM &&
|
||||||
field_types[field_pos] <= MYSQL_TYPE_GEOMETRY));
|
field_types[field_pos] <= MYSQL_TYPE_GEOMETRY));
|
||||||
field_pos++;
|
field_pos++;
|
||||||
|
@ -3991,47 +3991,78 @@ bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool check_grant_all_columns(THD *thd, ulong want_access, GRANT_INFO *grant,
|
/**
|
||||||
const char* db_name, const char *table_name,
|
@brief check if a query can access a set of columns
|
||||||
Field_iterator *fields)
|
|
||||||
|
@param thd the current thread
|
||||||
|
@param want_access_arg the privileges requested
|
||||||
|
@param fields an iterator over the fields of a table reference.
|
||||||
|
@return Operation status
|
||||||
|
@retval 0 Success
|
||||||
|
@retval 1 Falure
|
||||||
|
@details This function walks over the columns of a table reference
|
||||||
|
The columns may originate from different tables, depending on the kind of
|
||||||
|
table reference, e.g. join.
|
||||||
|
For each table it will retrieve the grant information and will use it
|
||||||
|
to check the required access privileges for the fields requested from it.
|
||||||
|
*/
|
||||||
|
bool check_grant_all_columns(THD *thd, ulong want_access_arg,
|
||||||
|
Field_iterator_table_ref *fields)
|
||||||
{
|
{
|
||||||
Security_context *sctx= thd->security_ctx;
|
Security_context *sctx= thd->security_ctx;
|
||||||
GRANT_TABLE *grant_table;
|
ulong want_access= want_access_arg;
|
||||||
GRANT_COLUMN *grant_column;
|
const char *table_name= NULL;
|
||||||
|
|
||||||
want_access &= ~grant->privilege;
|
const char* db_name;
|
||||||
if (!want_access)
|
GRANT_INFO *grant;
|
||||||
return 0; // Already checked
|
/* Initialized only to make gcc happy */
|
||||||
|
GRANT_TABLE *grant_table= NULL;
|
||||||
|
|
||||||
rw_rdlock(&LOCK_grant);
|
rw_rdlock(&LOCK_grant);
|
||||||
|
|
||||||
/* reload table if someone has modified any grants */
|
|
||||||
|
|
||||||
if (grant->version != grant_version)
|
|
||||||
{
|
|
||||||
grant->grant_table=
|
|
||||||
table_hash_search(sctx->host, sctx->ip, db_name,
|
|
||||||
sctx->priv_user,
|
|
||||||
table_name, 0); /* purecov: inspected */
|
|
||||||
grant->version= grant_version; /* purecov: inspected */
|
|
||||||
}
|
|
||||||
/* The following should always be true */
|
|
||||||
if (!(grant_table= grant->grant_table))
|
|
||||||
goto err; /* purecov: inspected */
|
|
||||||
|
|
||||||
for (; !fields->end_of_fields(); fields->next())
|
for (; !fields->end_of_fields(); fields->next())
|
||||||
{
|
{
|
||||||
const char *field_name= fields->name();
|
const char *field_name= fields->name();
|
||||||
grant_column= column_hash_search(grant_table, field_name,
|
|
||||||
(uint) strlen(field_name));
|
if (table_name != fields->table_name())
|
||||||
if (!grant_column || (~grant_column->rights & want_access))
|
{
|
||||||
goto err;
|
table_name= fields->table_name();
|
||||||
|
db_name= fields->db_name();
|
||||||
|
grant= fields->grant();
|
||||||
|
/* get a fresh one for each table */
|
||||||
|
want_access= want_access_arg & ~grant->privilege;
|
||||||
|
if (want_access)
|
||||||
|
{
|
||||||
|
/* reload table if someone has modified any grants */
|
||||||
|
if (grant->version != grant_version)
|
||||||
|
{
|
||||||
|
grant->grant_table=
|
||||||
|
table_hash_search(sctx->host, sctx->ip, db_name,
|
||||||
|
sctx->priv_user,
|
||||||
|
table_name, 0); /* purecov: inspected */
|
||||||
|
grant->version= grant_version; /* purecov: inspected */
|
||||||
|
}
|
||||||
|
|
||||||
|
grant_table= grant->grant_table;
|
||||||
|
DBUG_ASSERT (grant_table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (want_access)
|
||||||
|
{
|
||||||
|
GRANT_COLUMN *grant_column=
|
||||||
|
column_hash_search(grant_table, field_name,
|
||||||
|
(uint) strlen(field_name));
|
||||||
|
if (!grant_column || (~grant_column->rights & want_access))
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
|
|
||||||
char command[128];
|
char command[128];
|
||||||
get_privilege_desc(command, sizeof(command), want_access);
|
get_privilege_desc(command, sizeof(command), want_access);
|
||||||
my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
|
my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
|
||||||
|
@ -244,9 +244,8 @@ bool check_grant_column (THD *thd, GRANT_INFO *grant,
|
|||||||
const char *name, uint length, Security_context *sctx);
|
const char *name, uint length, Security_context *sctx);
|
||||||
bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref,
|
bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref,
|
||||||
const char *name, uint length);
|
const char *name, uint length);
|
||||||
bool check_grant_all_columns(THD *thd, ulong want_access, GRANT_INFO *grant,
|
bool check_grant_all_columns(THD *thd, ulong want_access,
|
||||||
const char* db_name, const char *table_name,
|
Field_iterator_table_ref *fields);
|
||||||
Field_iterator *fields);
|
|
||||||
bool check_grant_routine(THD *thd, ulong want_access,
|
bool check_grant_routine(THD *thd, ulong want_access,
|
||||||
TABLE_LIST *procs, bool is_proc, bool no_error);
|
TABLE_LIST *procs, bool is_proc, bool no_error);
|
||||||
bool check_grant_db(THD *thd,const char *db);
|
bool check_grant_db(THD *thd,const char *db);
|
||||||
|
@ -6553,10 +6553,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
|
|||||||
!any_privileges)
|
!any_privileges)
|
||||||
{
|
{
|
||||||
field_iterator.set(tables);
|
field_iterator.set(tables);
|
||||||
if (check_grant_all_columns(thd, SELECT_ACL, field_iterator.grant(),
|
if (check_grant_all_columns(thd, SELECT_ACL, &field_iterator))
|
||||||
field_iterator.db_name(),
|
|
||||||
field_iterator.table_name(),
|
|
||||||
&field_iterator))
|
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2107,7 +2107,7 @@ class select_insert :public select_result_interceptor {
|
|||||||
ulonglong autoinc_value_of_last_inserted_row; // autogenerated or not
|
ulonglong autoinc_value_of_last_inserted_row; // autogenerated or not
|
||||||
COPY_INFO info;
|
COPY_INFO info;
|
||||||
bool insert_into_view;
|
bool insert_into_view;
|
||||||
|
bool is_bulk_insert_mode;
|
||||||
select_insert(TABLE_LIST *table_list_par,
|
select_insert(TABLE_LIST *table_list_par,
|
||||||
TABLE *table_par, List<Item> *fields_par,
|
TABLE *table_par, List<Item> *fields_par,
|
||||||
List<Item> *update_fields, List<Item> *update_values,
|
List<Item> *update_fields, List<Item> *update_values,
|
||||||
|
@ -189,11 +189,9 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
Field_iterator_table field_it;
|
Field_iterator_table_ref field_it;
|
||||||
field_it.set_table(table);
|
field_it.set(table_list);
|
||||||
if (check_grant_all_columns(thd, INSERT_ACL, &table->grant,
|
if (check_grant_all_columns(thd, INSERT_ACL, &field_it))
|
||||||
table->s->db.str, table->s->table_name.str,
|
|
||||||
&field_it))
|
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
clear_timestamp_auto_bits(table->timestamp_field_type,
|
clear_timestamp_auto_bits(table->timestamp_field_type,
|
||||||
@ -2778,7 +2776,8 @@ select_insert::select_insert(TABLE_LIST *table_list_par, TABLE *table_par,
|
|||||||
bool ignore_check_option_errors)
|
bool ignore_check_option_errors)
|
||||||
:table_list(table_list_par), table(table_par), fields(fields_par),
|
:table_list(table_list_par), table(table_par), fields(fields_par),
|
||||||
autoinc_value_of_last_inserted_row(0),
|
autoinc_value_of_last_inserted_row(0),
|
||||||
insert_into_view(table_list_par && table_list_par->view != 0)
|
insert_into_view(table_list_par && table_list_par->view != 0),
|
||||||
|
is_bulk_insert_mode(FALSE)
|
||||||
{
|
{
|
||||||
bzero((char*) &info,sizeof(info));
|
bzero((char*) &info,sizeof(info));
|
||||||
info.handle_duplicates= duplic;
|
info.handle_duplicates= duplic;
|
||||||
@ -2964,8 +2963,11 @@ int select_insert::prepare2(void)
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("select_insert::prepare2");
|
DBUG_ENTER("select_insert::prepare2");
|
||||||
if (thd->lex->current_select->options & OPTION_BUFFER_RESULT &&
|
if (thd->lex->current_select->options & OPTION_BUFFER_RESULT &&
|
||||||
!thd->prelocked_mode)
|
!thd->prelocked_mode && !is_bulk_insert_mode)
|
||||||
|
{
|
||||||
table->file->ha_start_bulk_insert((ha_rows) 0);
|
table->file->ha_start_bulk_insert((ha_rows) 0);
|
||||||
|
is_bulk_insert_mode= TRUE;
|
||||||
|
}
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3084,6 +3086,7 @@ bool select_insert::send_eof()
|
|||||||
trans_table, table->file->table_type()));
|
trans_table, table->file->table_type()));
|
||||||
|
|
||||||
error= (!thd->prelocked_mode) ? table->file->ha_end_bulk_insert():0;
|
error= (!thd->prelocked_mode) ? table->file->ha_end_bulk_insert():0;
|
||||||
|
is_bulk_insert_mode= FALSE;
|
||||||
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
|
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
|
||||||
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
|
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
|
||||||
|
|
||||||
@ -3307,7 +3310,10 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
Create_field *cr_field;
|
Create_field *cr_field;
|
||||||
Field *field, *def_field;
|
Field *field, *def_field;
|
||||||
if (item->type() == Item::FUNC_ITEM)
|
if (item->type() == Item::FUNC_ITEM)
|
||||||
field= item->tmp_table_field(&tmp_table);
|
if (item->result_type() != STRING_RESULT)
|
||||||
|
field= item->tmp_table_field(&tmp_table);
|
||||||
|
else
|
||||||
|
field= item->tmp_table_field_from_field_type(&tmp_table, 0);
|
||||||
else
|
else
|
||||||
field= create_tmp_field(thd, &tmp_table, item, item->type(),
|
field= create_tmp_field(thd, &tmp_table, item, item->type(),
|
||||||
(Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0,
|
(Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0,
|
||||||
@ -3518,7 +3524,10 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
if (info.handle_duplicates == DUP_UPDATE)
|
if (info.handle_duplicates == DUP_UPDATE)
|
||||||
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
|
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
|
||||||
if (!thd->prelocked_mode)
|
if (!thd->prelocked_mode)
|
||||||
|
{
|
||||||
table->file->ha_start_bulk_insert((ha_rows) 0);
|
table->file->ha_start_bulk_insert((ha_rows) 0);
|
||||||
|
is_bulk_insert_mode= TRUE;
|
||||||
|
}
|
||||||
thd->abort_on_warning= (!info.ignore &&
|
thd->abort_on_warning= (!info.ignore &&
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
|
@ -259,6 +259,8 @@ public:
|
|||||||
key_name.str= str;
|
key_name.str= str;
|
||||||
key_name.length= length;
|
key_name.length= length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print(THD *thd, String *str);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -5766,7 +5766,12 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
|
|||||||
ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->table_name);
|
ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->table_name);
|
||||||
if (!schema_table ||
|
if (!schema_table ||
|
||||||
(schema_table->hidden &&
|
(schema_table->hidden &&
|
||||||
(sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0))
|
((sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0 ||
|
||||||
|
/*
|
||||||
|
this check is used for show columns|keys from I_S hidden table
|
||||||
|
*/
|
||||||
|
lex->sql_command == SQLCOM_SHOW_FIELDS ||
|
||||||
|
lex->sql_command == SQLCOM_SHOW_KEYS)))
|
||||||
{
|
{
|
||||||
my_error(ER_UNKNOWN_TABLE, MYF(0),
|
my_error(ER_UNKNOWN_TABLE, MYF(0),
|
||||||
ptr->table_name, INFORMATION_SCHEMA_NAME.str);
|
ptr->table_name, INFORMATION_SCHEMA_NAME.str);
|
||||||
|
@ -1651,6 +1651,9 @@ static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff);
|
|||||||
|
|
||||||
static SHOW_VAR fixed_vars[]= {
|
static SHOW_VAR fixed_vars[]= {
|
||||||
{"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
|
{"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
|
||||||
|
{"relay_log" , (char*) &opt_relay_logname, SHOW_CHAR_PTR},
|
||||||
|
{"relay_log_index", (char*) &opt_relaylog_index_name, SHOW_CHAR_PTR},
|
||||||
|
{"relay_log_info_file", (char*) &relay_log_info_file, SHOW_CHAR_PTR},
|
||||||
{"relay_log_space_limit", (char*) &relay_log_space_limit, SHOW_LONGLONG},
|
{"relay_log_space_limit", (char*) &relay_log_space_limit, SHOW_LONGLONG},
|
||||||
{"slave_load_tmpdir", (char*) &slave_load_tmpdir, SHOW_CHAR_PTR},
|
{"slave_load_tmpdir", (char*) &slave_load_tmpdir, SHOW_CHAR_PTR},
|
||||||
{"slave_skip_errors", (char*) &show_slave_skip_errors, SHOW_FUNC},
|
{"slave_skip_errors", (char*) &show_slave_skip_errors, SHOW_FUNC},
|
||||||
|
@ -1695,7 +1695,7 @@ JOIN::exec()
|
|||||||
test_if_skip_sort_order(&join_tab[const_tables], order,
|
test_if_skip_sort_order(&join_tab[const_tables], order,
|
||||||
select_limit, 0,
|
select_limit, 0,
|
||||||
&join_tab[const_tables].table->
|
&join_tab[const_tables].table->
|
||||||
keys_in_use_for_order_by))))
|
keys_in_use_for_query))))
|
||||||
order=0;
|
order=0;
|
||||||
having= tmp_having;
|
having= tmp_having;
|
||||||
select_describe(this, need_tmp,
|
select_describe(this, need_tmp,
|
||||||
@ -12614,6 +12614,8 @@ find_field_in_item_list (Field *field, void *data)
|
|||||||
If we can use an index, the JOIN_TAB / tab->select struct
|
If we can use an index, the JOIN_TAB / tab->select struct
|
||||||
is changed to use the index.
|
is changed to use the index.
|
||||||
|
|
||||||
|
The index must cover all fields in <order>, or it will not be considered.
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
0 We have to use filesort to do the sorting
|
0 We have to use filesort to do the sorting
|
||||||
1 We can use an index.
|
1 We can use an index.
|
||||||
@ -12773,12 +12775,6 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
|||||||
LINT_INIT(best_key_direction);
|
LINT_INIT(best_key_direction);
|
||||||
LINT_INIT(best_records);
|
LINT_INIT(best_records);
|
||||||
|
|
||||||
/*
|
|
||||||
filesort() and join cache are usually faster than reading in
|
|
||||||
index order and not using join cache
|
|
||||||
*/
|
|
||||||
if (tab->type == JT_ALL && tab->join->tables > tab->join->const_tables + 1)
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
/*
|
/*
|
||||||
If not used with LIMIT, only use keys if the whole query can be
|
If not used with LIMIT, only use keys if the whole query can be
|
||||||
resolved with a key; This is because filesort() is usually faster than
|
resolved with a key; This is because filesort() is usually faster than
|
||||||
@ -12786,6 +12782,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
|||||||
*/
|
*/
|
||||||
if (select_limit >= table_records)
|
if (select_limit >= table_records)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
filesort() and join cache are usually faster than reading in
|
||||||
|
index order and not using join cache
|
||||||
|
*/
|
||||||
|
if (tab->type == JT_ALL && tab->join->tables > tab->join->const_tables + 1)
|
||||||
|
DBUG_RETURN(0);
|
||||||
keys= *table->file->keys_to_use_for_scanning();
|
keys= *table->file->keys_to_use_for_scanning();
|
||||||
keys.merge(table->covering_keys);
|
keys.merge(table->covering_keys);
|
||||||
|
|
||||||
@ -14798,6 +14800,9 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
|
|||||||
item_field= (Item*) new Item_field(field);
|
item_field= (Item*) new Item_field(field);
|
||||||
if (!item_field)
|
if (!item_field)
|
||||||
DBUG_RETURN(TRUE); // Fatal error
|
DBUG_RETURN(TRUE); // Fatal error
|
||||||
|
|
||||||
|
if (item->real_item()->type() != Item::FIELD_ITEM)
|
||||||
|
field->orig_table= 0;
|
||||||
item_field->name= item->name;
|
item_field->name= item->name;
|
||||||
if (item->type() == Item::REF_ITEM)
|
if (item->type() == Item::REF_ITEM)
|
||||||
{
|
{
|
||||||
@ -16043,6 +16048,43 @@ static void print_join(THD *thd, String *str, List<TABLE_LIST> *tables)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Print an index hint
|
||||||
|
|
||||||
|
@details Prints out the USE|FORCE|IGNORE index hint.
|
||||||
|
|
||||||
|
@param thd the current thread
|
||||||
|
@param[out] str appends the index hint here
|
||||||
|
@param hint what the hint is (as string : "USE INDEX"|
|
||||||
|
"FORCE INDEX"|"IGNORE INDEX")
|
||||||
|
@param hint_length the length of the string in 'hint'
|
||||||
|
@param indexes a list of index names for the hint
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
Index_hint::print(THD *thd, String *str)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case INDEX_HINT_IGNORE: str->append(STRING_WITH_LEN("IGNORE INDEX")); break;
|
||||||
|
case INDEX_HINT_USE: str->append(STRING_WITH_LEN("USE INDEX")); break;
|
||||||
|
case INDEX_HINT_FORCE: str->append(STRING_WITH_LEN("FORCE INDEX")); break;
|
||||||
|
}
|
||||||
|
str->append (STRING_WITH_LEN(" ("));
|
||||||
|
if (key_name.length)
|
||||||
|
{
|
||||||
|
if (thd && !my_strnncoll(system_charset_info,
|
||||||
|
(const uchar *)key_name.str, key_name.length,
|
||||||
|
(const uchar *)primary_key_name,
|
||||||
|
strlen(primary_key_name)))
|
||||||
|
str->append(primary_key_name);
|
||||||
|
else
|
||||||
|
append_identifier(thd, str, key_name.str, key_name.length);
|
||||||
|
}
|
||||||
|
str->append(')');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Print table as it should be in join list
|
Print table as it should be in join list
|
||||||
|
|
||||||
@ -16110,6 +16152,18 @@ void TABLE_LIST::print(THD *thd, String *str)
|
|||||||
str->append(' ');
|
str->append(' ');
|
||||||
append_identifier(thd, str, alias, strlen(alias));
|
append_identifier(thd, str, alias, strlen(alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index_hints)
|
||||||
|
{
|
||||||
|
List_iterator<Index_hint> it(*index_hints);
|
||||||
|
Index_hint *hint;
|
||||||
|
|
||||||
|
while ((hint= it++))
|
||||||
|
{
|
||||||
|
str->append (STRING_WITH_LEN(" "));
|
||||||
|
hint->print (thd, str);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3339,7 +3339,8 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||||||
/*
|
/*
|
||||||
If we have lookup db value we should check that the database exists
|
If we have lookup db value we should check that the database exists
|
||||||
*/
|
*/
|
||||||
if(lookup_field_vals.db_value.str && !lookup_field_vals.wild_db_value)
|
if(lookup_field_vals.db_value.str && !lookup_field_vals.wild_db_value &&
|
||||||
|
!with_i_schema)
|
||||||
{
|
{
|
||||||
char path[FN_REFLEN+16];
|
char path[FN_REFLEN+16];
|
||||||
uint path_len;
|
uint path_len;
|
||||||
|
@ -223,9 +223,6 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
|||||||
{
|
{
|
||||||
LEX *lex= thd->lex;
|
LEX *lex= thd->lex;
|
||||||
bool link_to_local;
|
bool link_to_local;
|
||||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
|
||||||
bool definer_check_is_needed= mode != VIEW_ALTER || lex->definer;
|
|
||||||
#endif
|
|
||||||
/* first table in list is target VIEW name => cut off it */
|
/* first table in list is target VIEW name => cut off it */
|
||||||
TABLE_LIST *view= lex->unlink_first_table(&link_to_local);
|
TABLE_LIST *view= lex->unlink_first_table(&link_to_local);
|
||||||
TABLE_LIST *tables= lex->query_tables;
|
TABLE_LIST *tables= lex->query_tables;
|
||||||
@ -280,7 +277,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
|||||||
- same as current user
|
- same as current user
|
||||||
- current user has SUPER_ACL
|
- current user has SUPER_ACL
|
||||||
*/
|
*/
|
||||||
if (definer_check_is_needed &&
|
if (lex->definer &&
|
||||||
(strcmp(lex->definer->user.str, thd->security_ctx->priv_user) != 0 ||
|
(strcmp(lex->definer->user.str, thd->security_ctx->priv_user) != 0 ||
|
||||||
my_strcasecmp(system_charset_info,
|
my_strcasecmp(system_charset_info,
|
||||||
lex->definer->host.str,
|
lex->definer->host.str,
|
||||||
@ -672,7 +669,7 @@ static File_option view_parameters[]=
|
|||||||
FILE_OPTIONS_STRING},
|
FILE_OPTIONS_STRING},
|
||||||
{{(char*) STRING_WITH_LEN("view_body_utf8")},
|
{{(char*) STRING_WITH_LEN("view_body_utf8")},
|
||||||
my_offsetof(TABLE_LIST, view_body_utf8),
|
my_offsetof(TABLE_LIST, view_body_utf8),
|
||||||
FILE_OPTIONS_STRING},
|
FILE_OPTIONS_ESTRING},
|
||||||
{{NullS, 0}, 0,
|
{{NullS, 0}, 0,
|
||||||
FILE_OPTIONS_STRING}
|
FILE_OPTIONS_STRING}
|
||||||
};
|
};
|
||||||
@ -953,6 +950,12 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (table->index_hints && table->index_hints->elements)
|
||||||
|
{
|
||||||
|
my_error(ER_WRONG_USAGE, MYF(0), "index hints", "VIEW");
|
||||||
|
DBUG_RETURN(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/* check loop via view definition */
|
/* check loop via view definition */
|
||||||
for (TABLE_LIST *precedent= table->referencing_view;
|
for (TABLE_LIST *precedent= table->referencing_view;
|
||||||
precedent;
|
precedent;
|
||||||
|
@ -483,15 +483,16 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
|||||||
uint key_length, uchar *page_buf, uint nod_flag)
|
uint key_length, uchar *page_buf, uint nod_flag)
|
||||||
{
|
{
|
||||||
double increase;
|
double increase;
|
||||||
double best_incr = DBL_MAX;
|
double best_incr;
|
||||||
double area;
|
double area;
|
||||||
double best_area;
|
double best_area;
|
||||||
uchar *best_key;
|
uchar *best_key= NULL;
|
||||||
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
|
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
|
||||||
uchar *last = rt_PAGE_END(page_buf);
|
uchar *last = rt_PAGE_END(page_buf);
|
||||||
|
|
||||||
LINT_INIT(best_area);
|
LINT_INIT(best_area);
|
||||||
LINT_INIT(best_key);
|
LINT_INIT(best_key);
|
||||||
|
LINT_INIT(best_incr);
|
||||||
|
|
||||||
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
|
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
|
||||||
{
|
{
|
||||||
@ -500,22 +501,13 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
|||||||
&area)) == -1.0)
|
&area)) == -1.0)
|
||||||
return NULL;
|
return NULL;
|
||||||
/* The following should be safe, even if we compare doubles */
|
/* The following should be safe, even if we compare doubles */
|
||||||
if (increase < best_incr)
|
if (!best_key || increase < best_incr ||
|
||||||
|
((increase == best_incr) && (area < best_area)))
|
||||||
{
|
{
|
||||||
best_key = k;
|
best_key = k;
|
||||||
best_area = area;
|
best_area = area;
|
||||||
best_incr = increase;
|
best_incr = increase;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* The following should be safe, even if we compare doubles */
|
|
||||||
if ((increase == best_incr) && (area < best_area))
|
|
||||||
{
|
|
||||||
best_key = k;
|
|
||||||
best_area = area;
|
|
||||||
best_incr = increase;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return best_key;
|
return best_key;
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,10 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Calculates MBR_AREA(a+b) - MBR_AREA(a)
|
Calculates MBR_AREA(a+b) - MBR_AREA(a)
|
||||||
|
Note: when 'a' and 'b' objects are far from each other,
|
||||||
|
the area increase can be really big, so this function
|
||||||
|
can return 'inf' as a result.
|
||||||
*/
|
*/
|
||||||
double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
|
||||||
uint key_length, double *ab_area)
|
uint key_length, double *ab_area)
|
||||||
|
@ -15999,7 +15999,7 @@ static void test_bug21635()
|
|||||||
char *query_end;
|
char *query_end;
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
MYSQL_FIELD *field;
|
MYSQL_FIELD *field;
|
||||||
unsigned int field_count, i;
|
unsigned int field_count, i, j;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
DBUG_ENTER("test_bug21635");
|
DBUG_ENTER("test_bug21635");
|
||||||
@ -16015,30 +16015,39 @@ static void test_bug21635()
|
|||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql, "CREATE TABLE t1 (i INT)");
|
rc= mysql_query(mysql, "CREATE TABLE t1 (i INT)");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)");
|
/*
|
||||||
myquery(rc);
|
We need this loop to ensure correct behavior with both constant and
|
||||||
|
non-constant tables.
|
||||||
|
*/
|
||||||
|
for (j= 0; j < 2 ; j++)
|
||||||
|
{
|
||||||
|
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)");
|
||||||
|
myquery(rc);
|
||||||
|
|
||||||
rc= mysql_real_query(mysql, query, query_end - query);
|
rc= mysql_real_query(mysql, query, query_end - query);
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
|
|
||||||
result= mysql_use_result(mysql);
|
result= mysql_use_result(mysql);
|
||||||
DIE_UNLESS(result);
|
DIE_UNLESS(result);
|
||||||
|
|
||||||
field_count= mysql_field_count(mysql);
|
field_count= mysql_field_count(mysql);
|
||||||
for (i= 0; i < field_count; ++i)
|
for (i= 0; i < field_count; ++i)
|
||||||
{
|
{
|
||||||
field= mysql_fetch_field_direct(result, i);
|
field= mysql_fetch_field_direct(result, i);
|
||||||
if (!opt_silent)
|
if (!opt_silent)
|
||||||
printf("%s -> %s ... ", expr[i * 2], field->name);
|
if (!opt_silent)
|
||||||
|
printf("%s -> %s ... ", expr[i * 2], field->name);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
DIE_UNLESS(field->db[0] == 0 && field->org_table[0] == 0 &&
|
DIE_UNLESS(field->db[0] == 0 && field->org_table[0] == 0 &&
|
||||||
field->table[0] == 0 && field->org_name[0] == 0);
|
field->table[0] == 0 && field->org_name[0] == 0);
|
||||||
DIE_UNLESS(strcmp(field->name, expr[i * 2 + 1]) == 0);
|
DIE_UNLESS(strcmp(field->name, expr[i * 2 + 1]) == 0);
|
||||||
if (!opt_silent)
|
if (!opt_silent)
|
||||||
puts("OK");
|
if (!opt_silent)
|
||||||
|
puts("OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
|
}
|
||||||
rc= mysql_query(mysql, "DROP TABLE t1");
|
rc= mysql_query(mysql, "DROP TABLE t1");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user