mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge from 5.0 trunk.
This commit is contained in:
69
mysql-test/t/binlog_index.test
Normal file
69
mysql-test/t/binlog_index.test
Normal file
@ -0,0 +1,69 @@
|
||||
#
|
||||
# testing of purging of binary log files bug#18199/Bug#18453
|
||||
#
|
||||
source include/have_log_bin.inc;
|
||||
source include/not_embedded.inc;
|
||||
|
||||
#
|
||||
# testing purge binary logs TO
|
||||
#
|
||||
|
||||
flush logs;
|
||||
flush logs;
|
||||
flush logs;
|
||||
|
||||
source include/show_binary_logs.inc;
|
||||
|
||||
remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
|
||||
|
||||
# there must be a warning with file names
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
purge binary logs TO 'master-bin.000004';
|
||||
|
||||
--echo *** must show a list starting from the 'TO' argument of PURGE ***
|
||||
source include/show_binary_logs.inc;
|
||||
|
||||
#
|
||||
# testing purge binary logs BEFORE
|
||||
#
|
||||
|
||||
reset master;
|
||||
|
||||
flush logs;
|
||||
flush logs;
|
||||
flush logs;
|
||||
remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
|
||||
|
||||
--echo *** must be a warning master-bin.000001 was not found ***
|
||||
let $date=`select NOW() + INTERVAL 1 MINUTE`;
|
||||
--disable_query_log
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval purge binary logs BEFORE '$date';
|
||||
--enable_query_log
|
||||
|
||||
--echo *** must show one record, of the active binlog, left in the index file after PURGE ***
|
||||
source include/show_binary_logs.inc;
|
||||
|
||||
#
|
||||
# testing a fatal error
|
||||
# Turning a binlog file into a directory must be a portable setup
|
||||
#
|
||||
|
||||
reset master;
|
||||
|
||||
flush logs;
|
||||
flush logs;
|
||||
flush logs;
|
||||
|
||||
remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
|
||||
mkdir $MYSQLTEST_VARDIR/log/master-bin.000001;
|
||||
|
||||
--error ER_BINLOG_PURGE_FATAL_ERR
|
||||
purge binary logs TO 'master-bin.000002';
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
show warnings;
|
||||
rmdir $MYSQLTEST_VARDIR/log/master-bin.000001;
|
||||
--disable_warnings
|
||||
reset master;
|
||||
--enable_warnings
|
||||
--echo End of tests
|
@ -142,7 +142,6 @@ CREATE TABLE t1(a INT) ENGINE=BLACKHOLE;
|
||||
INSERT DELAYED INTO t1 VALUES(1);
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
#Bug#19717: DELETE Query Error on BLACKHOLE when using WHERE on column with UNIQUE INDEX
|
||||
@ -159,4 +158,27 @@ ALTER TABLE t1 ADD PRIMARY KEY(a);
|
||||
DELETE FROM t1 WHERE a=10;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
#
|
||||
# Bug#35178 INSERT_ID not written to binary log for inserts against BLACKHOLE backed tables
|
||||
#
|
||||
#
|
||||
# the test checks that explicitly prescribed with set insert_id= value
|
||||
# preceeds the following autoincrement insert in a blachhole
|
||||
#
|
||||
|
||||
reset master;
|
||||
create table t1 (a int auto_increment, primary key (a)) engine=blackhole;
|
||||
|
||||
# not insert_id prescribed insert binlogs with the default set insert_id 1
|
||||
insert into t1 values (11), (NULL), (NULL), (NULL);
|
||||
set insert_id= 3;
|
||||
insert into t1 values (NULL), (33), (NULL);
|
||||
set insert_id= 5;
|
||||
insert into t1 values (55), (NULL);
|
||||
source include/show_binlog_events2.inc;
|
||||
|
||||
# cleanup
|
||||
drop table t1;
|
||||
|
||||
|
||||
# End of tests
|
||||
|
@ -53,4 +53,18 @@ alter table t1 change c1 c1 mediumtext character set gbk not null;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#35993: severe memory corruption and crash with multibyte conversion
|
||||
#
|
||||
|
||||
CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk,
|
||||
b MEDIUMTEXT CHARACTER SET big5);
|
||||
INSERT INTO t1 VALUES
|
||||
(REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', '');
|
||||
|
||||
SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
|
||||
SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
|
||||
|
||||
DROP TABLES t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
1
mysql-test/t/federated_disabled-master.opt
Normal file
1
mysql-test/t/federated_disabled-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--skip-federated
|
3
mysql-test/t/federated_disabled.test
Normal file
3
mysql-test/t/federated_disabled.test
Normal file
@ -0,0 +1,3 @@
|
||||
source include/federated.inc;
|
||||
|
||||
SHOW VARIABLES LIKE 'have_federated_engine';
|
@ -164,4 +164,13 @@ drop table t1, t2;
|
||||
|
||||
set session low_priority_updates=default;
|
||||
|
||||
#
|
||||
# Bug #33334 mysqltest_embedded crashes when disconnecting before reap
|
||||
#
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
send select benchmark(200, (select sin(1))) > 1000;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -68,3 +68,13 @@ create table t1(f1 varchar(6)) charset=utf8;
|
||||
insert into t1 values ("123456");
|
||||
select concat(f1, 2) a from t1 union select 'x' a from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #36488: regexp returns false matches, concatenating with previous rows
|
||||
#
|
||||
CREATE TABLE t1 (c1 varchar(100), c2 varchar(100));
|
||||
INSERT INTO t1 VALUES ('',''), ('','First'), ('Random','Random');
|
||||
SELECT * FROM t1 WHERE CONCAT(c1,' ',c2) REGEXP 'First.*';
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # End of 5.0 tests
|
||||
|
@ -657,4 +657,40 @@ SELECT s1.d1 FROM
|
||||
) AS s1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #35298: GROUP_CONCAT with DISTINCT can crash the server
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a INT);
|
||||
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
SELECT GROUP_CONCAT(DISTINCT t2.a) FROM t1 LEFT JOIN t2 ON t2.a = t1.a GROUP BY t1.a;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug #36024: group_concat distinct in subquery crash
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT, KEY(a));
|
||||
CREATE TABLE t2 (b INT);
|
||||
|
||||
INSERT INTO t1 VALUES (NULL), (8), (2);
|
||||
INSERT INTO t2 VALUES (4), (10);
|
||||
|
||||
SELECT 1 FROM t1 WHERE t1.a NOT IN
|
||||
(
|
||||
SELECT GROUP_CONCAT(DISTINCT t1.a)
|
||||
FROM t1 WHERE t1.a IN
|
||||
(
|
||||
SELECT b FROM t2
|
||||
)
|
||||
AND NOT t1.a >= (SELECT t1.a FROM t1 LIMIT 1)
|
||||
GROUP BY t1.a
|
||||
);
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -916,5 +916,15 @@ DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE=DEFAULT;
|
||||
|
||||
#
|
||||
# Bug #34512: CAST( AVG( double ) AS DECIMAL ) returns wrong results
|
||||
#
|
||||
|
||||
CREATE TABLE t1(a DOUBLE);
|
||||
INSERT INTO t1 VALUES (10), (20);
|
||||
SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
###
|
||||
--echo End of 5.0 tests
|
||||
|
@ -94,36 +94,192 @@ show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #6760: Add SLEEP() function
|
||||
# Bug#6760: Add SLEEP() function (feature request)
|
||||
#
|
||||
# Logics of original test:
|
||||
# Reveal that a query with SLEEP does not need less time than estimated.
|
||||
#
|
||||
# Bug#12689: SLEEP() gets incorrectly cached/optimized-away
|
||||
#
|
||||
# Description from bug report (slightly modified)
|
||||
#
|
||||
# Bug 1 (happened all time):
|
||||
# SELECT * FROM t1 WHERE SLEEP(1) will only result in a sleep of 1
|
||||
# second, regardless of the number of rows in t1.
|
||||
# Bug 2 (happened all time):
|
||||
# Such a query will also get cached by the query cache, but should not.
|
||||
#
|
||||
# Notes (mleich, 2008-05)
|
||||
# =======================
|
||||
#
|
||||
# Experiments around
|
||||
# Bug#36345 Test 'func_misc' fails on RHAS3 x86_64
|
||||
# showed that the tests for both bugs could produce in case of parallel
|
||||
# artificial system time (like via ntpd)
|
||||
# - decreases false alarm
|
||||
# - increases false success
|
||||
#
|
||||
# We try here to circumvent these issues by reimplementation of the tests
|
||||
# and sophisticated scripting, although the cause of the problems is a massive
|
||||
# error within the setup of the testing environment.
|
||||
# Tests relying on or checking derivates of the system time must never meet
|
||||
# parallel manipulations of system time.
|
||||
#
|
||||
# Results of experiments with/without manipulation of system time,
|
||||
# information_schema.processlist content, high load on testing box
|
||||
# ----------------------------------------------------------------
|
||||
# Definition: Predicted_cumulative_sleep_time =
|
||||
# #_of_result_rows * sleep_time_per_result_row
|
||||
#
|
||||
# 1. Total (real sleep time) ~= predicted_cumulative_sleep_time !!
|
||||
# 2. The state of a session within the PROCESSLIST changes to 'User sleep'
|
||||
# if the sessions runs a statement containing the sleep function and the
|
||||
# processing of the statement is just within the phase where the sleep
|
||||
# is done. (*)
|
||||
# 3. NOW() and processlist.time behave "synchronous" to system time and
|
||||
# show also the "jumps" caused by system time manipulations. (*)
|
||||
# 4. processlist.time is unsigned, the "next" value below 0 is ~ 4G (*)
|
||||
# 5. Current processlist.time ~= current real sleep time if the system time
|
||||
# was not manipulated. (*)
|
||||
# 6. High system load can cause delays of <= 2 seconds.
|
||||
# 7. Thanks to Davi for excellent hints and ideas.
|
||||
#
|
||||
# (*)
|
||||
# - information_schema.processlist is not available before MySQL 5.1.
|
||||
# - Observation of processlist content requires a
|
||||
# - "worker" session sending the query with "send" and pulling results
|
||||
# with "reap"
|
||||
# - session observing the processlist parallel to the worker session
|
||||
# "send" and "reap" do not work in case of an embedded server.
|
||||
# Conclusion: Tests based on processlist have too many restrictions.
|
||||
#
|
||||
# Solutions for subtests based on TIMEDIFF of values filled via NOW()
|
||||
# -------------------------------------------------------------------
|
||||
# Run the following sequence three times
|
||||
# 1. SELECT <start_time>
|
||||
# 2. Query with SLEEP
|
||||
# 3. SELECT <end_time>
|
||||
# If TIMEDIFF(<end_time>,<start_time>) is at least two times within a
|
||||
# reasonable range assume that we did not met errors we were looking for.
|
||||
#
|
||||
# It is extreme unlikely that we have two system time changes within the
|
||||
# < 30 seconds runtime. Even if the unlikely happens, there are so
|
||||
# frequent runs of this test on this or another testing box which will
|
||||
# catch the problem.
|
||||
#
|
||||
create table t1 (a timestamp default '2005-05-05 01:01:01',
|
||||
b timestamp default '2005-05-05 01:01:01');
|
||||
insert into t1 set a = now();
|
||||
select sleep(3);
|
||||
update t1 set b = now();
|
||||
select timediff(b, a) >= '00:00:03' from t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #------------------------------------------------------------------------
|
||||
--echo # Tests for Bug#6760 and Bug#12689
|
||||
# Number of rows within the intended result set.
|
||||
SET @row_count = 4;
|
||||
# Parameter within SLEEP function
|
||||
SET @sleep_time_per_result_row = 1;
|
||||
# Maximum acceptable delay caused by high load on testing box
|
||||
SET @max_acceptable_delay = 2;
|
||||
# TIMEDIFF = time for query with sleep (mostly the time caused by SLEEP)
|
||||
# + time for delays caused by high load on testing box
|
||||
# Ensure that at least a reasonable fraction of TIMEDIFF belongs to the SLEEP
|
||||
# by appropriate setting of variables.
|
||||
# Ensure that any "judging" has a base of minimum three attempts.
|
||||
# (Test 2 uses all attempts except the first one.)
|
||||
if (!` SELECT (@sleep_time_per_result_row * @row_count - @max_acceptable_delay >
|
||||
@sleep_time_per_result_row) AND (@row_count - 1 >= 3)`)
|
||||
{
|
||||
--echo # Have to abort because of error in plausibility check
|
||||
--echo ######################################################
|
||||
--vertical_results
|
||||
SELECT @sleep_time_per_result_row * @row_count - @max_acceptable_delay >
|
||||
@sleep_time_per_result_row AS must_be_1,
|
||||
@row_count - 1 >= 3 AS must_be_also_1,
|
||||
@sleep_time_per_result_row, @row_count, @max_acceptable_delay;
|
||||
exit;
|
||||
}
|
||||
SET @@global.query_cache_size = 1024 * 64;
|
||||
--disable_warnings
|
||||
DROP TEMPORARY TABLE IF EXISTS t_history;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
CREATE TEMPORARY TABLE t_history (attempt SMALLINT,
|
||||
start_ts DATETIME, end_ts DATETIME,
|
||||
start_cached INTEGER, end_cached INTEGER);
|
||||
CREATE TABLE t1 (f1 BIGINT);
|
||||
let $num = `SELECT @row_count`;
|
||||
while ($num)
|
||||
{
|
||||
INSERT INTO t1 VALUES (1);
|
||||
dec $num;
|
||||
}
|
||||
|
||||
let $loops = 4;
|
||||
let $num = $loops;
|
||||
while ($num)
|
||||
{
|
||||
let $Qcache_queries_in_cache =
|
||||
query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1);
|
||||
eval
|
||||
INSERT INTO t_history
|
||||
SET attempt = $loops - $num + 1, start_ts = NOW(),
|
||||
start_cached = $Qcache_queries_in_cache;
|
||||
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
|
||||
#
|
||||
# Do not determine Qcache_queries_in_cache before updating end_ts. The SHOW
|
||||
# might cost too much time on an overloaded box.
|
||||
eval
|
||||
UPDATE t_history SET end_ts = NOW()
|
||||
WHERE attempt = $loops - $num + 1;
|
||||
let $Qcache_queries_in_cache =
|
||||
query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1);
|
||||
eval
|
||||
UPDATE t_history SET end_cached = $Qcache_queries_in_cache
|
||||
WHERE attempt = $loops - $num + 1;
|
||||
# DEBUG eval SELECT * FROM t_history WHERE attempt = $loops - $num + 1;
|
||||
dec $num;
|
||||
}
|
||||
|
||||
# 1. The majority of queries with SLEEP must need a reasonable time
|
||||
# -> SLEEP has an impact on runtime
|
||||
# = Replacement for original Bug#6760 test
|
||||
# -> total runtime is clear more needed than for one result row needed
|
||||
# = Replacement for one of the original Bug#12689 tests
|
||||
--echo # Test 1: Does the query with SLEEP need a reasonable time?
|
||||
eval SELECT COUNT(*) >= $loops - 1 INTO @aux1 FROM t_history
|
||||
WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
|
||||
BETWEEN 0 AND @max_acceptable_delay;
|
||||
SELECT @aux1 AS "Expect 1";
|
||||
#
|
||||
# Bug #12689: SLEEP() gets incorrectly cached/optimized-away
|
||||
# 2. The majority of queries (the first one must be ignored) with SLEEP must
|
||||
# need a reasonable time
|
||||
# -> If we assume that the result of a cached query will be sent back
|
||||
# immediate, without any sleep, than the query with SLEEP cannot be cached
|
||||
# (current and intended behaviour for queries with SLEEP).
|
||||
# -> It could be also not excluded that the query was cached but the server
|
||||
# honoured somehow the SLEEP. Such a behaviour would be also acceptable.
|
||||
# = Replacement for one of the original Bug#12689 tests
|
||||
--echo # Test 2: Does the query with SLEEP need a reasonable time even in case
|
||||
--echo # of the non first execution?
|
||||
eval SELECT COUNT(*) >= $loops - 1 - 1 INTO @aux2 FROM t_history
|
||||
WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
|
||||
BETWEEN 0 AND @max_acceptable_delay
|
||||
AND attempt > 1;
|
||||
SELECT @aux2 AS "Expect 1";
|
||||
#
|
||||
set global query_cache_size=1355776;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(1),(1);
|
||||
create table t2 (a datetime default null, b datetime default null);
|
||||
insert into t2 set a = now();
|
||||
select a from t1 where sleep(1);
|
||||
update t2 set b = now() where b is null;
|
||||
insert into t2 set a = now();
|
||||
select a from t1 where sleep(a);
|
||||
update t2 set b = now() where b is null;
|
||||
insert into t2 set a = now();
|
||||
select a from t1 where sleep(1);
|
||||
update t2 set b = now() where b is null;
|
||||
select timediff(b, a) >= '00:00:03' from t2;
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
set global query_cache_size=default;
|
||||
# 3. The query with SLEEP should be not cached.
|
||||
# -> SHOW STATUS Qcache_queries_in_cache must be not incremented after
|
||||
# the execution of the query with SLEEP
|
||||
--echo # Test 3: The query with SLEEP must be not cached.
|
||||
eval SELECT COUNT(*) = $loops INTO @aux3 FROM t_history
|
||||
WHERE end_cached = start_cached;
|
||||
SELECT @aux3 AS "Expect 1";
|
||||
#
|
||||
# Dump the content of t_history if one of the tests failed.
|
||||
if (`SELECT @aux1 + @aux2 + @aux3 <> 3`)
|
||||
{
|
||||
--echo # Some tests failed, dumping the content of t_history
|
||||
SELECT * FROM t_history;
|
||||
}
|
||||
DROP TABLE t1;
|
||||
DROP TEMPORARY TABLE t_history;
|
||||
SET @@global.query_cache_size = default;
|
||||
|
||||
#
|
||||
# Bug #21466: INET_ATON() returns signed, not unsigned
|
||||
@ -223,7 +379,7 @@ SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter
|
||||
# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter
|
||||
# resolved against a column name of a derived table hangs the client
|
||||
#
|
||||
|
||||
|
@ -1153,4 +1153,26 @@ DROP DATABASE db27878;
|
||||
use test;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #33201 Crash occurs when granting update privilege on one column of a view
|
||||
#
|
||||
drop table if exists test;
|
||||
drop function if exists test_function;
|
||||
drop view if exists v1;
|
||||
create table test (col1 varchar(30));
|
||||
delimiter |;
|
||||
create function test_function() returns varchar(30)
|
||||
begin
|
||||
declare tmp varchar(30);
|
||||
select col1 from test limit 1 into tmp;
|
||||
return '1';
|
||||
end|
|
||||
delimiter ;|
|
||||
create view v1 as select test.* from test where test.col1=test_function();
|
||||
grant update (col1) on v1 to 'greg'@'localhost';
|
||||
drop user 'greg'@'localhost';
|
||||
drop view v1;
|
||||
drop table test;
|
||||
drop function test_function;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -893,4 +893,121 @@ FROM t1;
|
||||
DROP TABLE t1;
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#27219: Aggregate functions in ORDER BY.
|
||||
--echo #
|
||||
SET @save_sql_mode=@@sql_mode;
|
||||
SET @@sql_mode='ONLY_FULL_GROUP_BY';
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT, c INT DEFAULT 0);
|
||||
INSERT INTO t1 (a, b) VALUES (3,3), (2,2), (3,3), (2,2), (3,3), (4,4);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
|
||||
SELECT 1 FROM t1 ORDER BY COUNT(*);
|
||||
SELECT 1 FROM t1 ORDER BY COUNT(*) + 1;
|
||||
--error 1140
|
||||
SELECT 1 FROM t1 ORDER BY COUNT(*) + a;
|
||||
SELECT 1 FROM t1 ORDER BY COUNT(*), 1;
|
||||
--error 1140
|
||||
SELECT 1 FROM t1 ORDER BY COUNT(*), a;
|
||||
|
||||
SELECT 1 FROM t1 ORDER BY SUM(a);
|
||||
SELECT 1 FROM t1 ORDER BY SUM(a + 1);
|
||||
SELECT 1 FROM t1 ORDER BY SUM(a) + 1;
|
||||
--error 1140
|
||||
SELECT 1 FROM t1 ORDER BY SUM(a), b;
|
||||
|
||||
--error 1140
|
||||
SELECT a FROM t1 ORDER BY COUNT(b);
|
||||
|
||||
SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2);
|
||||
|
||||
--error 1140
|
||||
SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a), t2.a FROM t2);
|
||||
--error 1140
|
||||
SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2 ORDER BY t2.a);
|
||||
--error 1140
|
||||
SELECT t1.a FROM t1 ORDER BY (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1);
|
||||
|
||||
--error 1140
|
||||
SELECT t1.a FROM t1
|
||||
WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1);
|
||||
--error 1140
|
||||
SELECT t1.a FROM t1 GROUP BY t1.a
|
||||
HAVING t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
|
||||
|
||||
SELECT t1.a FROM t1 GROUP BY t1.a
|
||||
HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY SUM(t1.b));
|
||||
--error 1140
|
||||
SELECT t1.a FROM t1 GROUP BY t1.a
|
||||
HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b));
|
||||
--error 1140
|
||||
SELECT t1.a FROM t1 GROUP BY t1.a
|
||||
HAVING t1.a > ANY (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b));
|
||||
|
||||
--error 1140
|
||||
SELECT t1.a FROM t1
|
||||
WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t1.b));
|
||||
|
||||
SELECT 1 FROM t1 GROUP BY t1.a
|
||||
HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
|
||||
SELECT 1 FROM t1 GROUP BY t1.a
|
||||
HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
|
||||
SELECT 1 FROM t1 GROUP BY t1.a
|
||||
HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
|
||||
|
||||
--error 1140
|
||||
SELECT 1 FROM t1 GROUP BY t1.a
|
||||
HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY t2.a LIMIT 1);
|
||||
--error 1140
|
||||
SELECT 1 FROM t1 GROUP BY t1.a
|
||||
HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY t2.a LIMIT 1);
|
||||
--error 1140
|
||||
SELECT 1 FROM t1 GROUP BY t1.a
|
||||
HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY t2.a LIMIT 1);
|
||||
|
||||
# Both SUMs are aggregated in the subquery, no mixture:
|
||||
SELECT t1.a FROM t1
|
||||
WHERE t1.a = (SELECT t2.a FROM t2 GROUP BY t2.a
|
||||
ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1);
|
||||
|
||||
# SUM(t1.b) is aggregated in the subquery, no mixture:
|
||||
SELECT t1.a, SUM(t1.b) FROM t1
|
||||
WHERE t1.a = (SELECT SUM(t2.b) FROM t2 GROUP BY t2.a
|
||||
ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1)
|
||||
GROUP BY t1.a;
|
||||
|
||||
# 2nd SUM(t1.b) is aggregated in the subquery, no mixture:
|
||||
SELECT t1.a, SUM(t1.b) FROM t1
|
||||
WHERE t1.a = (SELECT SUM(t2.b) FROM t2
|
||||
ORDER BY SUM(t2.b) + SUM(t1.b) LIMIT 1)
|
||||
GROUP BY t1.a;
|
||||
|
||||
# SUM(t2.b + t1.a) is aggregated in the subquery, no mixture:
|
||||
SELECT t1.a, SUM(t1.b) FROM t1
|
||||
WHERE t1.a = (SELECT SUM(t2.b) FROM t2
|
||||
ORDER BY SUM(t2.b + t1.a) LIMIT 1)
|
||||
GROUP BY t1.a;
|
||||
|
||||
SELECT t1.a FROM t1 GROUP BY t1.a
|
||||
HAVING (1, 1) = (SELECT SUM(t1.a), t1.a FROM t2 LIMIT 1);
|
||||
|
||||
select avg (
|
||||
(select
|
||||
(select sum(outr.a + innr.a) from t1 as innr limit 1) as tt
|
||||
from t1 as outr order by outr.a limit 1))
|
||||
from t1 as most_outer;
|
||||
|
||||
--error 1140
|
||||
select avg (
|
||||
(select (
|
||||
(select sum(outr.a + innr.a) from t1 as innr limit 1)) as tt
|
||||
from t1 as outr order by count(outr.a) limit 1)) as tt
|
||||
from t1 as most_outer;
|
||||
|
||||
select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order by outr.a;
|
||||
|
||||
SET sql_mode=@save_sql_mode;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -1113,8 +1113,6 @@ select * from `information_schema`.`TRIGGERS` where `EVENT_OBJECT_TABLE` = NULL;
|
||||
select * from `information_schema`.`VIEWS` where `TABLE_SCHEMA` = NULL;
|
||||
select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
#
|
||||
# Bug#30079 A check for "hidden" I_S tables is flawed
|
||||
#
|
||||
@ -1123,3 +1121,28 @@ show fields from information_schema.table_names;
|
||||
--error 1109
|
||||
show keys from information_schema.table_names;
|
||||
|
||||
#
|
||||
# Bug#34529: Crash on complex Falcon I_S select after ALTER .. PARTITION BY
|
||||
#
|
||||
USE information_schema;
|
||||
SET max_heap_table_size = 16384;
|
||||
|
||||
CREATE TABLE test.t1( a INT );
|
||||
|
||||
# What we need to create here is a bit of a corner case:
|
||||
# We need a star query with information_schema tables, where the first
|
||||
# branch of the star join produces zero rows, so that reading of the
|
||||
# second branch never happens. At the same time we have to make sure
|
||||
# that data for at least the last table is swapped from MEMORY/HEAP to
|
||||
# MyISAM. This and only this triggers the bug.
|
||||
SELECT *
|
||||
FROM tables ta
|
||||
JOIN collations co ON ( co.collation_name = ta.table_catalog )
|
||||
JOIN character_sets cs ON ( cs.character_set_name = ta.table_catalog );
|
||||
|
||||
DROP TABLE test.t1;
|
||||
SET max_heap_table_size = DEFAULT;
|
||||
USE test;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
|
@ -236,4 +236,86 @@ SELECT * FROM t1;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo # --
|
||||
--echo # -- Bug#35469: server crash with LOAD DATA INFILE to a VIEW.
|
||||
--echo # --
|
||||
|
||||
--echo
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP VIEW IF EXISTS v2;
|
||||
DROP VIEW IF EXISTS v3;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
CREATE TABLE t1(c1 INT, c2 VARCHAR(255));
|
||||
|
||||
--echo
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1;
|
||||
CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2;
|
||||
|
||||
--echo
|
||||
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1
|
||||
FIELDS ESCAPED BY '\\'
|
||||
TERMINATED BY ','
|
||||
ENCLOSED BY '"'
|
||||
LINES TERMINATED BY '\n' (c1, c2);
|
||||
|
||||
--echo
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo
|
||||
SELECT * FROM v1;
|
||||
|
||||
--echo
|
||||
DELETE FROM t1;
|
||||
|
||||
--echo
|
||||
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
|
||||
FIELDS ESCAPED BY '\\'
|
||||
TERMINATED BY ','
|
||||
ENCLOSED BY '"'
|
||||
LINES TERMINATED BY '\n' (c1, c2);
|
||||
|
||||
--echo
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo
|
||||
SELECT * FROM v2;
|
||||
|
||||
--echo
|
||||
DELETE FROM t1;
|
||||
|
||||
--echo
|
||||
--error ER_LOAD_DATA_INVALID_COLUMN
|
||||
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
|
||||
FIELDS ESCAPED BY '\\'
|
||||
TERMINATED BY ','
|
||||
ENCLOSED BY '"'
|
||||
LINES TERMINATED BY '\n' (c0, c2);
|
||||
|
||||
--echo
|
||||
--error ER_NON_UPDATABLE_TABLE
|
||||
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3
|
||||
FIELDS ESCAPED BY '\\'
|
||||
TERMINATED BY ','
|
||||
ENCLOSED BY '"'
|
||||
LINES TERMINATED BY '\n' (d1, d2);
|
||||
|
||||
--echo
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
DROP VIEW v2;
|
||||
DROP VIEW v3;
|
||||
|
||||
--echo
|
||||
--echo # -- End of Bug#35469.
|
||||
|
||||
###########################################################################
|
||||
|
||||
# End of 5.0 tests
|
||||
|
1
mysql-test/t/multi_update_tiny_hash-master.opt
Normal file
1
mysql-test/t/multi_update_tiny_hash-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--set-variable=max_heap_table_size=16384
|
61
mysql-test/t/multi_update_tiny_hash.test
Normal file
61
mysql-test/t/multi_update_tiny_hash.test
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# Test of update statement that uses many tables,
|
||||
# --max_heap_table_size=1
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # Bug #36676: multiupdate using LEFT JOIN updates only
|
||||
--echo # first row or fails with an error:
|
||||
--echo # ERROR 1022 (23000): Can't write; duplicate key in table ''
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
|
||||
--echo #
|
||||
--echo # Multiupdate creates MyISAM temporary table without MEMORY table
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (ID INT);
|
||||
CREATE TABLE t2 (ID INT,
|
||||
s1 TEXT, s2 TEXT, s3 VARCHAR(10), s4 TEXT, s5 VARCHAR(10));
|
||||
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT INTO t2 VALUES (1,'test', 'test', 'test', 'test', 'test'),
|
||||
(2,'test', 'test', 'test', 'test', 'test');
|
||||
|
||||
SELECT * FROM t1 LEFT JOIN t2 USING(ID);
|
||||
UPDATE t1 LEFT JOIN t2 USING(ID) SET s1 = 'changed';
|
||||
UPDATE t1 JOIN t2 USING(ID) SET s2 = 'changed';
|
||||
UPDATE t1 LEFT JOIN t2 USING(ID) SET s3 = 'changed';
|
||||
UPDATE t1 LEFT JOIN t2 USING(ID) SET s4 = 'changed', s5 = 'changed';
|
||||
SELECT * FROM t1 LEFT JOIN t2 USING(ID);
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # Multiupdate creates temporary MyISAM table from MEMORY table
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
|
||||
CREATE TABLE t2 (id INT, s1 CHAR(255));
|
||||
|
||||
# insert [1..64] into table `t1`
|
||||
INSERT INTO t1 VALUES (0), (0), (0), (0), (0), (0), (0), (0);
|
||||
INSERT INTO t1 (SELECT 0 FROM t1);
|
||||
INSERT INTO t1 (SELECT 0 FROM t1);
|
||||
INSERT INTO t1 (SELECT 0 FROM t1);
|
||||
|
||||
INSERT INTO t2 (SELECT ID, 'a' FROM t1);
|
||||
|
||||
UPDATE t1 LEFT JOIN t2 USING(id) SET s1 = 'b';
|
||||
|
||||
SELECT DISTINCT s1 FROM t1 LEFT JOIN t2 USING(id);
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
--echo # End of 5.0 tests
|
@ -59,3 +59,16 @@ source t/mysql_delimiter_19799.sql
|
||||
use test//
|
||||
show tables//
|
||||
delimiter ; # Reset delimiter
|
||||
|
||||
#
|
||||
# Bug #33812: mysql client incorrectly parsing DELIMITER
|
||||
#
|
||||
select a as delimiter from t1
|
||||
delimiter ; # Reset delimiter
|
||||
|
||||
#
|
||||
# Bug #36244: MySQL CLI doesn't recognize standalone -- as comment
|
||||
# before DELIMITER statement
|
||||
#
|
||||
--
|
||||
DELIMITER ;
|
||||
|
@ -972,4 +972,50 @@ EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #34731: highest possible value for INT erroneously filtered by WHERE
|
||||
#
|
||||
|
||||
# test UNSIGNED. only occurs when indexed.
|
||||
CREATE TABLE t1 (f1 TINYINT(11) UNSIGNED NOT NULL, PRIMARY KEY (f1));
|
||||
|
||||
INSERT INTO t1 VALUES (127),(254),(0),(1),(255);
|
||||
|
||||
# test upper bound
|
||||
# count 5
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256;
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256.0;
|
||||
# count 4
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 255;
|
||||
|
||||
# show we don't fiddle with lower bound on UNSIGNED
|
||||
# count 0
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < -1;
|
||||
# count 5
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# test signed. only occurs when index.
|
||||
CREATE TABLE t1 ( f1 TINYINT(11) NOT NULL, PRIMARY KEY (f1));
|
||||
|
||||
INSERT INTO t1 VALUES (127),(126),(0),(-128),(-127);
|
||||
|
||||
# test upper bound
|
||||
# count 5
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128;
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128.0;
|
||||
# count 4
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 127;
|
||||
|
||||
# test lower bound
|
||||
# count 5
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129;
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129.0;
|
||||
# count 4
|
||||
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -128;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -113,3 +113,33 @@ SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# BUG#36055 - mysql_upgrade doesn't really 'upgrade' tables
|
||||
#
|
||||
|
||||
--echo # Test with a saved table from 4.1
|
||||
--copy_file std_data/bug36055.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm
|
||||
--copy_file std_data/bug36055.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD
|
||||
--copy_file std_data/bug36055.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI
|
||||
|
||||
--replace_column 12 # 13 #
|
||||
SHOW TABLE STATUS LIKE 't1';
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Run CHECK TABLE, it should indicate table need a REPAIR TABLE
|
||||
CHECK TABLE t1 FOR UPGRADE;
|
||||
|
||||
--echo # REPAIR old table USE_FRM should fail
|
||||
REPAIR TABLE t1 USE_FRM;
|
||||
|
||||
--echo # Run REPAIR TABLE to upgrade .frm file
|
||||
REPAIR TABLE t1;
|
||||
--replace_column 12 # 13 #
|
||||
SHOW TABLE STATUS LIKE 't1';
|
||||
SELECT * FROM t1;
|
||||
|
||||
REPAIR TABLE t1 USE_FRM;
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
109
mysql-test/t/rpl_auto_increment_bug33029.test
Normal file
109
mysql-test/t/rpl_auto_increment_bug33029.test
Normal file
@ -0,0 +1,109 @@
|
||||
# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting
|
||||
# using a trig in SP
|
||||
|
||||
# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive,
|
||||
# if one statement in a SP generated AUTO_INCREMENT value by the top
|
||||
# statement, all statements after it would be considered generated
|
||||
# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID
|
||||
# value might be associated with these statement, which could cause
|
||||
# duplicate entry error and stop the slave.
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP TRIGGER IF EXISTS tr1;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY);
|
||||
CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY);
|
||||
|
||||
delimiter //;
|
||||
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 10;
|
||||
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
|
||||
DELETE FROM t1 WHERE id = 1;
|
||||
DELETE FROM t1 WHERE id = 2;
|
||||
DELETE FROM t2 WHERE id = 1;
|
||||
DELETE FROM t2 WHERE id = 2;
|
||||
END//
|
||||
|
||||
CREATE PROCEDURE p2()
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1 WHERE id = f1(3);
|
||||
DELETE FROM t1 WHERE id = f1(4);
|
||||
DELETE FROM t2 WHERE id = 3;
|
||||
DELETE FROM t2 WHERE id = 4;
|
||||
END//
|
||||
|
||||
CREATE TRIGGER tr1 BEFORE DELETE
|
||||
ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t2 VALUES (NULL);
|
||||
END//
|
||||
|
||||
CREATE FUNCTION f1 (i int) RETURNS int
|
||||
BEGIN
|
||||
INSERT INTO t2 VALUES (NULL);
|
||||
RETURN i;
|
||||
END//
|
||||
|
||||
delimiter ;//
|
||||
|
||||
# the $binlog_start will be used by the show_binlog_events.inc, so
|
||||
# that we can skip binlog events we don't care
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
CALL p1();
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
echo # Result on master;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
echo # Result on slave;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
connection master;
|
||||
|
||||
DROP TRIGGER tr1;
|
||||
|
||||
# the $binlog_start will be used by the show_binlog_events.inc, so
|
||||
# that we can skip binlog events we don't care
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
CALL p2();
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
echo # Result on master;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
echo # Result on slave;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
# clean up
|
||||
connection master;
|
||||
disable_warnings;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP TRIGGER IF EXISTS tr1;
|
||||
enable_warnings;
|
||||
sync_slave_with_master;
|
@ -13,13 +13,25 @@ enable_warnings;
|
||||
eval create database $db;
|
||||
|
||||
connection master;
|
||||
select @@net_buffer_length, @@max_allowed_packet;
|
||||
SET @@global.max_allowed_packet=1024;
|
||||
SET @@global.net_buffer_length=1024;
|
||||
|
||||
# Restart slave for setting to take effect
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
|
||||
# Reconnect to master for new setting to take effect
|
||||
disconnect master;
|
||||
|
||||
# alas, can't use eval here; if db name changed apply the change here
|
||||
connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________);
|
||||
|
||||
connection master;
|
||||
select @@net_buffer_length, @@max_allowed_packet;
|
||||
|
||||
create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
|
||||
|
||||
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
|
||||
@ -52,7 +64,9 @@ SET @@global.net_buffer_length=4096;
|
||||
# Restart slave for new setting to take effect
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
|
||||
# Reconnect to master for new setting to take effect
|
||||
disconnect master;
|
||||
|
@ -577,3 +577,55 @@ set global log_bin_trust_function_creators=0;
|
||||
drop database mysqltest;
|
||||
drop database mysqltest2;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug#36570: Parse error of CREATE PROCEDURE stmt with comments on slave
|
||||
#
|
||||
connection master;
|
||||
use test;
|
||||
delimiter |;
|
||||
|
||||
/*!50001 create procedure `mysqltestbug36570_p1`() */
|
||||
begin
|
||||
select 1;
|
||||
end|
|
||||
|
||||
use mysql|
|
||||
create procedure test.` mysqltestbug36570_p2`(/*!50001 a int*/)`label`:
|
||||
begin
|
||||
select a;
|
||||
end|
|
||||
|
||||
/*!50001 create function test.mysqltestbug36570_f1() */
|
||||
returns int
|
||||
/*!50001 deterministic */
|
||||
begin
|
||||
return 3;
|
||||
end|
|
||||
use test|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
--replace_column 5 t 6 t
|
||||
show procedure status like '%mysqltestbug36570%';
|
||||
show create procedure ` mysqltestbug36570_p2`;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
|
||||
--replace_column 5 t 6 t
|
||||
show procedure status like '%mysqltestbug36570%';
|
||||
show create procedure ` mysqltestbug36570_p2`;
|
||||
call ` mysqltestbug36570_p2`(42);
|
||||
|
||||
--replace_column 5 t 6 t
|
||||
show function status like '%mysqltestbug36570%';
|
||||
|
||||
connection master;
|
||||
flush logs;
|
||||
--replace_regex s/$MYSQL_TEST_DIR/MYSQL_TEST_DIR/ s/TIMESTAMP=[0-9]*/TIMESTAMP=t/
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
|
||||
use test;
|
||||
drop procedure mysqltestbug36570_p1;
|
||||
drop procedure ` mysqltestbug36570_p2`;
|
||||
drop function mysqltestbug36570_f1;
|
||||
|
@ -161,4 +161,22 @@ DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug#32575 Parse error of stmt with extended comments on slave side
|
||||
# Verify that 'CREATE VIEW' with comments is properly logged to binlog
|
||||
connection master;
|
||||
CREATE TABLE t1 (a INT);
|
||||
--echo # create view as output from mysqldump 10.11 (5.0.62)
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) */
|
||||
/*!50002 WITH CASCADED CHECK OPTION */;
|
||||
SHOW CREATE VIEW v1;
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE VIEW v1;
|
||||
connection master;
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -598,4 +598,36 @@ show procedure code proc_33618_c;
|
||||
drop procedure proc_33618_h;
|
||||
drop procedure proc_33618_c;
|
||||
|
||||
#
|
||||
# Bug#20906 (Multiple assignments in SET in stored routine produce incorrect
|
||||
# instructions)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists p_20906_a;
|
||||
drop procedure if exists p_20906_b;
|
||||
--enable_warnings
|
||||
|
||||
create procedure p_20906_a() SET @a=@a+1, @b=@b+1;
|
||||
show procedure code p_20906_a;
|
||||
|
||||
set @a=1;
|
||||
set @b=1;
|
||||
|
||||
call p_20906_a();
|
||||
select @a, @b;
|
||||
|
||||
create procedure p_20906_b() SET @a=@a+1, @b=@b+1, @c=@c+1;
|
||||
show procedure code p_20906_b;
|
||||
|
||||
set @a=1;
|
||||
set @b=1;
|
||||
set @c=1;
|
||||
|
||||
call p_20906_b();
|
||||
select @a, @b, @c;
|
||||
|
||||
drop procedure p_20906_a;
|
||||
drop procedure p_20906_b;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@ -9,28 +9,28 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2);
|
||||
explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2);
|
||||
SELECT (SELECT (SELECT 0 UNION SELECT 0));
|
||||
explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0));
|
||||
-- error 1247
|
||||
-- error ER_ILLEGAL_REFERENCE
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
|
||||
-- error 1247
|
||||
-- error ER_ILLEGAL_REFERENCE
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
|
||||
SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
|
||||
-- error 1247
|
||||
-- error ER_ILLEGAL_REFERENCE
|
||||
SELECT (SELECT a) as a;
|
||||
EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
SELECT (SELECT 1), a;
|
||||
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
SELECT 1 FROM (SELECT (SELECT a) b) c;
|
||||
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
|
||||
SELECT 1 IN (SELECT 1);
|
||||
SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
|
||||
-- error 1221
|
||||
-- error ER_WRONG_USAGE
|
||||
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
|
||||
-- error 1108
|
||||
-- error ER_WRONG_PARAMETERS_TO_PROCEDURE
|
||||
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
|
||||
@ -53,7 +53,7 @@ SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
|
||||
SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a');
|
||||
SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
|
||||
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a);
|
||||
|
||||
SELECT 1 as a,(SELECT a+a) b,(SELECT b);
|
||||
@ -65,7 +65,7 @@ create table t4 (a int not null, b int not null);
|
||||
insert into t1 values (2);
|
||||
insert into t2 values (1,7),(2,7);
|
||||
insert into t4 values (4,8),(3,8),(5,9);
|
||||
-- error 1247
|
||||
-- error ER_ILLEGAL_REFERENCE
|
||||
select (select a from t1 where t1.a = a1) as a2, (select b from t2 where t2.b=a2) as a1;
|
||||
select (select a from t1 where t1.a=t2.a), a from t2;
|
||||
select (select a from t1 where t1.a=t2.b), a from t2;
|
||||
@ -105,9 +105,9 @@ select * from t3 where a >= any (select b from t2);
|
||||
explain extended select * from t3 where a >= any (select b from t2);
|
||||
select * from t3 where a >= all (select b from t2);
|
||||
delete from t2 where a=100;
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select * from t3 where a in (select a,b from t2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select * from t3 where a in (select * from t2);
|
||||
insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10);
|
||||
# empty set
|
||||
@ -123,7 +123,7 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)
|
||||
insert into t5 values (2);
|
||||
select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
|
||||
explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
|
||||
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
|
||||
create table t7( uq int primary key, name char(25));
|
||||
@ -133,7 +133,7 @@ select * from t6 where exists (select * from t7 where uq = clinic_uq);
|
||||
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
|
||||
|
||||
# not unique fields
|
||||
-- error 1052
|
||||
-- error ER_NON_UNIQ_ERROR
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
|
||||
# different tipes & group functions
|
||||
@ -160,14 +160,14 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test');
|
||||
INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
|
||||
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
|
||||
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
|
||||
pseudo='joce');
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%');
|
||||
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
|
||||
@ -187,7 +187,7 @@ EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||
SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
||||
SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1);
|
||||
drop table t1;
|
||||
@ -213,9 +213,9 @@ CREATE TABLE `t2` (
|
||||
INSERT INTO t2 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce');
|
||||
select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
|
||||
SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='joce') AND date >= '2002-10-21' AND t1.numeropost = t2.topic) ORDER BY maxnumrep DESC LIMIT 0, 20;
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
|
||||
|
||||
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
|
||||
@ -244,9 +244,9 @@ CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM ROW_FORMAT=FIXED;
|
||||
|
||||
INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1);
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1);
|
||||
drop table t1;
|
||||
|
||||
@ -258,7 +258,7 @@ drop table t1;
|
||||
#iftest
|
||||
CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
|
||||
INSERT INTO t1 VALUES ();
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
|
||||
drop table t1;
|
||||
|
||||
@ -271,13 +271,13 @@ CREATE TABLE `t1` (
|
||||
UNIQUE KEY `numreponse` (`numreponse`),
|
||||
KEY `pseudo` (`pseudo`,`numeropost`)
|
||||
) ENGINE=MyISAM;
|
||||
-- error 1247
|
||||
-- error ER_ILLEGAL_REFERENCE
|
||||
SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
|
||||
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
|
||||
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
|
||||
EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
|
||||
@ -294,9 +294,9 @@ create table t2 (a int NOT NULL, b int, primary key (a));
|
||||
insert into t1 values (0, 10),(1, 11),(2, 12);
|
||||
insert into t2 values (1, 21),(2, 22),(3, 23);
|
||||
select * from t1;
|
||||
-- error 1093
|
||||
-- error ER_UPDATE_TABLE_USED
|
||||
update t1 set b= (select b from t1);
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
update t1 set b= (select b from t2);
|
||||
update t1 set b= (select b from t2 where t1.a = t2.a);
|
||||
select * from t1;
|
||||
@ -309,9 +309,9 @@ insert into t1 values (0, 10),(1, 11),(2, 12);
|
||||
insert into t2 values (1, 21),(2, 12),(3, 23);
|
||||
select * from t1;
|
||||
select * from t1 where b = (select b from t2 where t1.a = t2.a);
|
||||
-- error 1093
|
||||
-- error ER_UPDATE_TABLE_USED
|
||||
delete from t1 where b = (select b from t1);
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
delete from t1 where b = (select b from t2);
|
||||
delete from t1 where b = (select b from t2 where t1.a = t2.a);
|
||||
select * from t1;
|
||||
@ -327,9 +327,9 @@ insert into t12 values (33, 10),(22, 11),(2, 12);
|
||||
insert into t2 values (1, 21),(2, 12),(3, 23);
|
||||
select * from t11;
|
||||
select * from t12;
|
||||
-- error 1093
|
||||
-- error ER_UPDATE_TABLE_USED
|
||||
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
|
||||
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
|
||||
select * from t11;
|
||||
@ -342,25 +342,29 @@ create table t2 (a int);
|
||||
create table t3 (b int);
|
||||
insert into t2 values (1);
|
||||
insert into t3 values (1),(2);
|
||||
-- error 1093
|
||||
-- error ER_UPDATE_TABLE_USED
|
||||
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
|
||||
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
|
||||
select * from t1;
|
||||
insert into t2 values (1);
|
||||
let $row_count_before= `SELECT COUNT(*) FROM t1`;
|
||||
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
|
||||
-- sleep 1
|
||||
let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1;
|
||||
--source include/wait_condition.inc
|
||||
select * from t1;
|
||||
INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
|
||||
select * from t1;
|
||||
# After this, only data based on old t1 records should have been added.
|
||||
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
|
||||
select * from t1;
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
|
||||
let $row_count_before= `SELECT COUNT(*) FROM t1`;
|
||||
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
|
||||
-- sleep 1
|
||||
let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1;
|
||||
--source include/wait_condition.inc
|
||||
select * from t1;
|
||||
#
|
||||
#TODO: should be uncommented after bug 380 fix pushed
|
||||
@ -375,25 +379,30 @@ create table t3 (a int);
|
||||
insert into t2 values (1);
|
||||
insert into t3 values (1),(2);
|
||||
select * from t1;
|
||||
-- error 1093
|
||||
-- error ER_UPDATE_TABLE_USED
|
||||
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
|
||||
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
|
||||
select * from t1;
|
||||
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+2 FROM t2));
|
||||
select * from t1;
|
||||
let $row_count_before= `SELECT COUNT(*) FROM t1`;
|
||||
replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a FROM t2));
|
||||
-- sleep 1
|
||||
# We get one additional row
|
||||
let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1;
|
||||
--source include/wait_condition.inc
|
||||
select * from t1;
|
||||
let $row_count_before= `SELECT COUNT(*) FROM t1 WHERE y = 2`;
|
||||
replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a+1 FROM t2));
|
||||
-- sleep 1
|
||||
let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1 WHERE y = 2;
|
||||
--source include/wait_condition.inc
|
||||
select * from t1;
|
||||
replace LOW_PRIORITY into t1 (x, y) VALUES ((SELECT a+1 FROM t2), (SELECT a FROM t2));
|
||||
select * from t1;
|
||||
drop table t1, t2, t3;
|
||||
|
||||
-- error 1096
|
||||
-- error ER_NO_TABLES_USED
|
||||
SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *);
|
||||
|
||||
CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
|
||||
@ -406,14 +415,14 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
|
||||
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
|
||||
-- error 1093
|
||||
-- error ER_UPDATE_TABLE_USED
|
||||
INSERT INTO t2 VALUES ((SELECT * FROM t2));
|
||||
-- error 1093
|
||||
-- error ER_UPDATE_TABLE_USED
|
||||
INSERT INTO t2 VALUES ((SELECT id FROM t2));
|
||||
SELECT * FROM t2;
|
||||
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t1 values (1),(1);
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
UPDATE t2 SET id=(SELECT * FROM t1);
|
||||
drop table t2, t1;
|
||||
|
||||
@ -481,9 +490,9 @@ drop table t1,t2,t3;
|
||||
|
||||
#LIMIT is not supported now
|
||||
create table t1 (a float);
|
||||
-- error 1235
|
||||
-- error ER_NOT_SUPPORTED_YET
|
||||
select 10.5 IN (SELECT * from t1 LIMIT 1);
|
||||
-- error 1235
|
||||
-- error ER_NOT_SUPPORTED_YET
|
||||
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
|
||||
drop table t1;
|
||||
|
||||
@ -507,7 +516,7 @@ select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null);
|
||||
select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a');
|
||||
select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
|
||||
select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
|
||||
-- error 1235
|
||||
-- error ER_NOT_SUPPORTED_YET
|
||||
select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2);
|
||||
drop table t1;
|
||||
|
||||
@ -522,14 +531,14 @@ set @a:=2;
|
||||
set @a:=(SELECT a from t1);
|
||||
select @a;
|
||||
drop table t1;
|
||||
-- error 1146
|
||||
-- error ER_NO_SUCH_TABLE
|
||||
do (SELECT a from t1);
|
||||
-- error 1146
|
||||
-- error ER_NO_SUCH_TABLE
|
||||
set @a:=(SELECT a from t1);
|
||||
|
||||
CREATE TABLE t1 (a int, KEY(a));
|
||||
HANDLER t1 OPEN;
|
||||
-- error 1064
|
||||
-- error ER_PARSE_ERROR
|
||||
HANDLER t1 READ a=((SELECT 1));
|
||||
HANDLER t1 CLOSE;
|
||||
drop table t1;
|
||||
@ -627,7 +636,7 @@ drop table t1;
|
||||
#
|
||||
# error in IN
|
||||
#
|
||||
-- error 1146
|
||||
-- error ER_NO_SUCH_TABLE
|
||||
select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
|
||||
|
||||
#
|
||||
@ -698,7 +707,7 @@ CREATE TABLE `t1` (
|
||||
INSERT INTO t1 VALUES (1);
|
||||
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
|
||||
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
@ -855,7 +864,7 @@ create table t1 (s1 int);
|
||||
create table t2 (s1 int);
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (1);
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
@ -865,9 +874,9 @@ DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
|
||||
s2 CHAR(5) COLLATE latin1_swedish_ci);
|
||||
INSERT INTO t1 VALUES ('z','?');
|
||||
-- error 1267
|
||||
-- error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
select * from t1 where s1 > (select max(s2) from t1);
|
||||
-- error 1267
|
||||
-- error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
select * from t1 where s1 > any (select max(s2) from t1);
|
||||
drop table t1;
|
||||
|
||||
@ -885,7 +894,7 @@ drop table t1, t2;
|
||||
# row union
|
||||
#
|
||||
create table t1 (s1 char(5));
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select (select 'a','b' from t1 union select 'a','b' from t1) from t1;
|
||||
insert into t1 values ('tttt');
|
||||
select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' from t1);
|
||||
@ -963,7 +972,7 @@ CREATE TABLE t1 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES (1),(5);
|
||||
CREATE TABLE t2 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1;
|
||||
INSERT INTO t2 VALUES (2),(6);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select * from t1 where (1,2,6) in (select * from t2);
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
@ -973,7 +982,7 @@ DROP TABLE t1,t2;
|
||||
create table t1 (s1 int);
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
-- error 1242
|
||||
-- error ER_SUBQUERY_NO_1_ROW
|
||||
set sort_buffer_size = (select s1 from t1);
|
||||
do (select * from t1);
|
||||
drop table t1;
|
||||
@ -1003,11 +1012,11 @@ drop table t1, t2;
|
||||
#
|
||||
create table t1 (s1 int);
|
||||
create table t2 (s1 int);
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
select * from t1 where (select count(*) from t2 where t1.s2) = 1;
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
select count(*) from t2 group by t1.s2;
|
||||
drop table t1, t2;
|
||||
|
||||
@ -1032,9 +1041,13 @@ DROP TABLE t1;
|
||||
|
||||
create table t1 (a int, b decimal(13, 3));
|
||||
insert into t1 values (1, 0.123);
|
||||
let $outfile = $MYSQLTEST_VARDIR/master-data/test/subselect.out.file.1;
|
||||
--error 0,1
|
||||
--remove_file $outfile
|
||||
select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
|
||||
delete from t1;
|
||||
load data infile "subselect.out.file.1" into table t1;
|
||||
--remove_file $outfile
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
@ -1123,7 +1136,7 @@ drop table t1;
|
||||
create table t1(id int);
|
||||
create table t2(id int);
|
||||
create table t3(flag int);
|
||||
-- error 1064
|
||||
-- error ER_PARSE_ERROR
|
||||
select (select * from t3 where id not null) from t1, t2;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
@ -1212,31 +1225,31 @@ SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FR
|
||||
SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
|
||||
# row tests
|
||||
# < > >= <= and = ALL/ <> ANY do not support row operation
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a FROM t1 WHERE b = 2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE a > ANY (SELECT a,2 FROM t1 WHERE b = 2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a,2 FROM t1 WHERE b = 2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE (1,2) > ALL (SELECT a FROM t1 WHERE b = 2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE a > ALL (SELECT a,2 FROM t1 WHERE b = 2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE (1,2) > ALL (SELECT a,2 FROM t1 WHERE b = 2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE (1,2) = ALL (SELECT a,2 FROM t1 WHERE b = 2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE (1,2) <> ANY (SELECT a,2 FROM t1 WHERE b = 2);
|
||||
# following should be converted to IN
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a FROM t1 WHERE b = 2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE a = ANY (SELECT a,2 FROM t1 WHERE b = 2);
|
||||
SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a,2 FROM t1 WHERE b = 2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a FROM t1 WHERE b = 2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
SELECT a FROM t1 WHERE a <> ALL (SELECT a,2 FROM t1 WHERE b = 2);
|
||||
SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a,2 FROM t1 WHERE b = 2);
|
||||
SELECT a FROM t1 WHERE (a,1) = ANY (SELECT a,1 FROM t1 WHERE b = 2);
|
||||
@ -1441,7 +1454,7 @@ CREATE TABLE `t1` ( `master` int(10) unsigned NOT NULL default '0', `map` smalli
|
||||
INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,32,400),(4,12,32,400);
|
||||
CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
|
||||
INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
|
||||
-- error 1054
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
|
||||
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
|
||||
drop tables t1,t2;
|
||||
@ -1545,7 +1558,7 @@ drop table t1;
|
||||
#
|
||||
create table t1 (a1 int);
|
||||
create table t2 (b1 int);
|
||||
--error 1054
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
select * from t1 where a2 > any(select b1 from t2);
|
||||
select * from t1 where a1 > any(select b1 from t2);
|
||||
drop table t1,t2;
|
||||
@ -1566,11 +1579,11 @@ drop table t1;
|
||||
# Comparison subquery and row with nested rows
|
||||
#
|
||||
create table t1 (a integer, b integer);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select row(1,(2,2)) in (select * from t1 );
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select row(1,(2,2)) = (select * from t1 );
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select (select * from t1) = row(1,(2,2));
|
||||
drop table t1;
|
||||
|
||||
@ -1579,14 +1592,14 @@ drop table t1;
|
||||
#
|
||||
create table t1 (a integer);
|
||||
insert into t1 values (1);
|
||||
-- error 1247
|
||||
-- error ER_ILLEGAL_REFERENCE
|
||||
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ;
|
||||
-- error 1247
|
||||
-- error ER_ILLEGAL_REFERENCE
|
||||
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
|
||||
select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx );
|
||||
-- error 1247
|
||||
-- error ER_ILLEGAL_REFERENCE
|
||||
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
|
||||
-- error 1247
|
||||
-- error ER_ILLEGAL_REFERENCE
|
||||
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
|
||||
drop table t1;
|
||||
|
||||
@ -1723,17 +1736,17 @@ drop table t1, t2;
|
||||
#
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (1,2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select 1 = (select * from t1);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select (select * from t1) = 1;
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select (1,2) = (select a from t1);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select (select a from t1) = (1,2);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select (1,2,3) = (select * from t1);
|
||||
-- error 1241
|
||||
-- error ER_OPERAND_COLUMNS
|
||||
select (select * from t1) = (1,2,3);
|
||||
drop table t1;
|
||||
|
||||
@ -2014,21 +2027,21 @@ INSERT INTO t2 VALUES
|
||||
(2,1), (1,3), (2,1), (4,4), (2,2), (1,4);
|
||||
|
||||
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2 );
|
||||
--error 1242
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1);
|
||||
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2), a;
|
||||
--error 1242
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1), a;
|
||||
|
||||
SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 2);
|
||||
--error 1242
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 1);
|
||||
|
||||
|
||||
SELECT a FROM t1 GROUP BY a
|
||||
HAVING IFNULL((SELECT b FROM t2 WHERE b > 2),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
|
||||
--error 1242
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT a FROM t1 GROUP BY a
|
||||
HAVING IFNULL((SELECT b FROM t2 WHERE b > 1),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
|
||||
@ -2036,7 +2049,7 @@ SELECT a FROM t1 GROUP BY a
|
||||
SELECT a FROM t1 GROUP BY a
|
||||
HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
|
||||
--error 1242
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT a FROM t1 GROUP BY a
|
||||
HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)) > 3;
|
||||
@ -2044,7 +2057,7 @@ SELECT a FROM t1 GROUP BY a
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 2),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
|
||||
--error 1242
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 1),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
|
||||
@ -2052,7 +2065,7 @@ SELECT a FROM t1
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
|
||||
--error 1242
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
|
||||
@ -2263,12 +2276,12 @@ SELECT t1.a FROM t1 GROUP BY t1.a
|
||||
HAVING t1.a > ALL(SELECT t2.c FROM t2
|
||||
WHERE EXISTS(SELECT t3.e FROM t3 GROUP BY t3.e
|
||||
HAVING SUM(t1.a+t2.c) < t3.e/4));
|
||||
-- error 1111
|
||||
-- error ER_INVALID_GROUP_FUNC_USE
|
||||
SELECT t1.a FROM t1 GROUP BY t1.a
|
||||
HAVING t1.a > ALL(SELECT t2.c FROM t2
|
||||
WHERE EXISTS(SELECT t3.e FROM t3
|
||||
WHERE SUM(t1.a+t2.c) < t3.e/4));
|
||||
-- error 1111
|
||||
-- error ER_INVALID_GROUP_FUNC_USE
|
||||
SELECT t1.a from t1 GROUP BY t1.a HAVING AVG(SUM(t1.b)) > 20;
|
||||
|
||||
SELECT t1.a FROM t1 GROUP BY t1.a
|
||||
@ -2330,11 +2343,11 @@ drop table t1, t2;
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
|
||||
--error 1054
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
|
||||
--error 1054
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
|
||||
--error 1054
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
|
||||
|
||||
DROP TABLE t1;
|
||||
@ -2469,7 +2482,7 @@ SELECT * FROM t1
|
||||
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
|
||||
|
||||
#TODO:not supported
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
|
||||
from t1;
|
||||
|
||||
@ -2839,12 +2852,12 @@ SELECT a FROM t1 t0
|
||||
WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
|
||||
|
||||
SET @@sql_mode='ansi';
|
||||
--error 1111
|
||||
--error ER_INVALID_GROUP_FUNC_USE
|
||||
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
|
||||
--error 1111
|
||||
--error ER_INVALID_GROUP_FUNC_USE
|
||||
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
|
||||
|
||||
--error 1111
|
||||
--error ER_INVALID_GROUP_FUNC_USE
|
||||
SELECT a FROM t1 t0
|
||||
WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
|
||||
|
||||
@ -3032,9 +3045,9 @@ while ($should_work_nesting)
|
||||
while ($nesting)
|
||||
{
|
||||
--echo $nesting
|
||||
--error 0,1436
|
||||
--error 0,ER_STACK_OVERRUN_NEED_MORE
|
||||
eval $start $end;
|
||||
--error 0,1436
|
||||
--error 0,ER_STACK_OVERRUN_NEED_MORE
|
||||
eval explain $start $end;
|
||||
let $start= $start
|
||||
$start_app;
|
||||
@ -3259,5 +3272,28 @@ GROUP BY a4;
|
||||
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
|
||||
#
|
||||
# BUG#36139 "float, zerofill, crash with subquery"
|
||||
#
|
||||
create table t1 (a float(5,4) zerofill);
|
||||
create table t2 (a float(5,4),b float(2,0));
|
||||
|
||||
select t1.a from t1 where
|
||||
t1.a= (select b from t2 limit 1) and not
|
||||
t1.a= (select a from t2 limit 1) ;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug #36011: Server crash with explain extended on query with dependent
|
||||
# subqueries
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
|
@ -586,6 +586,36 @@ SELECT a FROM t1 WHERE a NOT IN (65,66);
|
||||
SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
|
||||
EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug #34763: item_subselect.cc:1235:Item_in_subselect::row_value_transformer:
|
||||
# Assertion failed, unexpected error message:
|
||||
# ERROR 1247 (42S22): Reference '<list ref>' not supported (forward
|
||||
# reference in item list)
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
CREATE TABLE t2 (placeholder CHAR(11));
|
||||
INSERT INTO t2 VALUES("placeholder");
|
||||
|
||||
SELECT ROW(1, 2) IN (SELECT t1.a, 2) FROM t1 GROUP BY t1.a;
|
||||
SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug #36005: crash in subselect with single row
|
||||
# (subselect_single_select_engine::exec)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
|
||||
SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -446,5 +446,169 @@ INSERT INTO t (c) VALUES (REPEAT('2',65536));
|
||||
INSERT INTO t (c) VALUES (REPEAT('3',65535));
|
||||
SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
|
||||
DROP TABLE t;
|
||||
# Bug#15776: 32-bit signed int used for length of blob
|
||||
# """LONGBLOB: A BLOB column with a maximum length of 4,294,967,295 or 4GB."""
|
||||
#
|
||||
# Conditions should be in this order:
|
||||
# A size is not in the allowed bounds.
|
||||
# If the type is char-ish AND size is within the max blob size:
|
||||
# raise ER_TOO_BIG_FIELDLENGTH (suggest using BLOB)
|
||||
# If size is too small:
|
||||
# raise ER_PARSE_ERROR
|
||||
# raise ER_TOO_BIG_DISPLAYWIDTH
|
||||
|
||||
# BLOB and TEXT types
|
||||
--disable_warnings
|
||||
drop table if exists b15776;
|
||||
--enable_warnings
|
||||
create table b15776 (data blob(2147483647));
|
||||
drop table b15776;
|
||||
--error ER_PARSE_ERROR
|
||||
create table b15776 (data blob(-1));
|
||||
create table b15776 (data blob(2147483648));
|
||||
drop table b15776;
|
||||
create table b15776 (data blob(4294967294));
|
||||
drop table b15776;
|
||||
create table b15776 (data blob(4294967295));
|
||||
drop table b15776;
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
create table b15776 (data blob(4294967296));
|
||||
|
||||
CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) );
|
||||
show columns from b15776;
|
||||
drop table b15776;
|
||||
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a blob(4294967296));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a text(4294967296));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||
|
||||
# Int types
|
||||
# "Another extension is supported by MySQL for optionally specifying the
|
||||
# display width of integer data types in parentheses following the base keyword
|
||||
# for the type (for example, INT(4)). This optional display width is used to
|
||||
# display integer values having a width less than the width specified for the
|
||||
# column by left-padding them with spaces." § Numeric Types
|
||||
CREATE TABLE b15776 (a int(0)); # 0 is special case, means default size
|
||||
INSERT INTO b15776 values (NULL), (1), (42), (654);
|
||||
SELECT * from b15776 ORDER BY a;
|
||||
DROP TABLE b15776;
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TABLE b15776 (a int(-1));
|
||||
CREATE TABLE b15776 (a int(255));
|
||||
DROP TABLE b15776;
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a int(256));
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TABLE b15776 (data blob(-1));
|
||||
|
||||
# Char types
|
||||
# Recommend BLOB
|
||||
--error ER_TOO_BIG_FIELDLENGTH
|
||||
CREATE TABLE b15776 (a char(2147483647));
|
||||
--error ER_TOO_BIG_FIELDLENGTH
|
||||
CREATE TABLE b15776 (a char(2147483648));
|
||||
--error ER_TOO_BIG_FIELDLENGTH
|
||||
CREATE TABLE b15776 (a char(4294967295));
|
||||
# Even BLOB won't hold
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a char(4294967296));
|
||||
|
||||
|
||||
# Other numeric-ish types
|
||||
## For year, widths not "2" or "4" are silently rewritten to "4". But
|
||||
## When we complain about it, we say that the max is 255. We may be
|
||||
## talking about different things. It's confusing.
|
||||
CREATE TABLE b15776 (a year(4294967295));
|
||||
INSERT INTO b15776 VALUES (42);
|
||||
SELECT * FROM b15776;
|
||||
DROP TABLE b15776;
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a year(4294967296));
|
||||
CREATE TABLE b15776 (a year(0)); # 0 is special case, means default size
|
||||
DROP TABLE b15776;
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TABLE b15776 (a year(-2));
|
||||
|
||||
## For timestamp, we silently rewrite widths to 14 or 19.
|
||||
CREATE TABLE b15776 (a timestamp(4294967294));
|
||||
DROP TABLE b15776;
|
||||
CREATE TABLE b15776 (a timestamp(4294967295));
|
||||
DROP TABLE b15776;
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a timestamp(4294967296));
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TABLE b15776 (a timestamp(-1));
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TABLE b15776 (a timestamp(-2));
|
||||
|
||||
|
||||
# We've already tested the case, but this should visually show that
|
||||
# widths that are too large to be interpreted cause DISPLAYWIDTH errors.
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
CREATE TABLE b15776 (a timestamp(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||
|
||||
## Do not select, too much memory needed.
|
||||
CREATE TABLE b15776 select cast(null as char(4294967295));
|
||||
show columns from b15776;
|
||||
drop table b15776;
|
||||
CREATE TABLE b15776 select cast(null as nchar(4294967295));
|
||||
show columns from b15776;
|
||||
drop table b15776;
|
||||
CREATE TABLE b15776 select cast(null as binary(4294967295));
|
||||
show columns from b15776;
|
||||
drop table b15776;
|
||||
|
||||
explain select cast(1 as char(4294967295));
|
||||
explain select cast(1 as nchar(4294967295));
|
||||
explain select cast(1 as binary(4294967295));
|
||||
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
explain select cast(1 as char(4294967296));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
explain select cast(1 as nchar(4294967296));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
explain select cast(1 as binary(4294967296));
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
explain select cast(1 as decimal(-1));
|
||||
explain select cast(1 as decimal(64, 30));
|
||||
# It's not as important which errors are raised for these, since the
|
||||
# limit is nowhere near 2**32. We may fix these eventually to take
|
||||
# 4294967295 and still reject it because it's greater than 64 or 30,
|
||||
# but that's not a high priority and the parser needn't worry about
|
||||
# such a weird case.
|
||||
--error ER_TOO_BIG_SCALE,ER_PARSE_ERROR
|
||||
explain select cast(1 as decimal(64, 999999999999999999999999999999));
|
||||
--error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR
|
||||
explain select cast(1 as decimal(4294967296));
|
||||
--error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR
|
||||
explain select cast(1 as decimal(999999999999999999999999999999999999));
|
||||
|
||||
explain select convert(1, char(4294967295));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
explain select convert(1, char(4294967296));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||
explain select convert(1, nchar(4294967295));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
explain select convert(1, nchar(4294967296));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||
explain select convert(1, binary(4294967295));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
explain select convert(1, binary(4294967296));
|
||||
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||
explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -521,4 +521,12 @@ SELECT ROUND(20061108085411.000002);
|
||||
|
||||
DROP TABLE t1, t2, t3, t4, t5, t6;
|
||||
|
||||
#
|
||||
# Bug#36023: Incorrect handling of zero length caused an assertion to fail.
|
||||
#
|
||||
create table t1(`c` decimal(9,2));
|
||||
insert into t1 values (300),(201.11);
|
||||
select max(case 1 when 1 then c else null end) from t1 group by c;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -3537,6 +3537,29 @@ DROP TABLE t1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- Bug#35193: VIEW query is rewritten without "FROM DUAL",
|
||||
--echo # -- causing syntax error
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo
|
||||
|
||||
CREATE VIEW v1 AS SELECT 1 FROM DUAL WHERE 1;
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM v1;
|
||||
SHOW CREATE TABLE v1;
|
||||
|
||||
--echo
|
||||
|
||||
DROP VIEW v1;
|
||||
|
||||
--echo
|
||||
--echo # -- End of test case for Bug#35193.
|
||||
--echo
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- End of 5.0 tests.
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user