1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Manual merge from mysql-next-mr.

Conflicts:
  - sql/log_event.cc
  - sql/sql_class.h
This commit is contained in:
Alexander Nozdrin
2010-02-15 14:16:49 +03:00
212 changed files with 6025 additions and 2402 deletions

View File

@ -1089,3 +1089,31 @@ ALTER TABLE t1
ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT,
AUTO_INCREMENT = 1;
DROP TABLE t1;
#
# Bug#50542 5.5.x doesn't check length of key prefixes:
# corruption and crash results
#
# This case is related to Bug#31031 (above)
# A statement where the index key is larger/wider than
# the column type, should cause an error
#
--error ER_WRONG_SUB_KEY
CREATE TABLE t1 (a CHAR(1), PRIMARY KEY (a(255)));
# Test other variants of creating indices
CREATE TABLE t1 (a CHAR(1));
# ALTER TABLE
--error ER_WRONG_SUB_KEY
ALTER TABLE t1 ADD PRIMARY KEY (a(20));
--error ER_WRONG_SUB_KEY
ALTER TABLE t1 ADD KEY (a(20));
# CREATE INDEX
--error ER_WRONG_SUB_KEY
CREATE UNIQUE INDEX i1 ON t1 (a(20));
--error ER_WRONG_SUB_KEY
CREATE INDEX i2 ON t1 (a(20));
# cleanup
DROP TABLE t1;

View File

@ -10,7 +10,7 @@ create table t1 (a int check (a>0));
insert into t1 values (1);
insert into t1 values (0);
drop table t1;
create table t1 (a int ,b int, check a>b);
create table t1 (a int, b int, check (a>b));
insert into t1 values (1,0);
insert into t1 values (0,1);
drop table t1;
@ -29,3 +29,45 @@ show create table t1;
drop table t1;
# End of 4.1 tests
#
# Bug#35578 (Parser allows useless/illegal CREATE TABLE syntax)
#
--disable_warnings
drop table if exists t_illegal;
--enable_warnings
--error ER_PARSE_ERROR
create table t_illegal (a int, b int, check a>b);
--error ER_PARSE_ERROR
create table t_illegal (a int, b int, constraint abc check a>b);
--error ER_PARSE_ERROR
create table t_illegal (a int, b int, constraint abc);
#
# Bug#11714 (Non-sensical ALTER TABLE ADD CONSTRAINT allowed)
#
--disable_warnings
drop table if exists t_11714;
--enable_warnings
create table t_11714(a int, b int);
--error ER_PARSE_ERROR
alter table t_11714 add constraint cons1;
drop table t_11714;
#
# Bug#38696 (CREATE TABLE ... CHECK ... allows illegal syntax)
--error ER_PARSE_ERROR
CREATE TABLE t_illegal (col_1 INT CHECK something (whatever));
--error ER_PARSE_ERROR
CREATE TABLE t_illegal (col_1 INT CHECK something);

View File

@ -23,3 +23,75 @@ create unique index b on t1 (a,b);
drop table t1;
# End of 4.1 tests
#
# Bug#34455 (Ambiguous foreign keys syntax is accepted)
#
--disable_warnings
drop table if exists t_34455;
--enable_warnings
# 2 match clauses, illegal
--error ER_PARSE_ERROR
create table t_34455 (
a int not null,
foreign key (a) references t3 (a) match full match partial);
# match after on delete, illegal
--error ER_PARSE_ERROR
create table t_34455 (
a int not null,
foreign key (a) references t3 (a) on delete set default match full);
# match after on update, illegal
--error ER_PARSE_ERROR
create table t_34455 (
a int not null,
foreign key (a) references t3 (a) on update set default match full);
# 2 on delete clauses, illegal
--error ER_PARSE_ERROR
create table t_34455 (
a int not null,
foreign key (a) references t3 (a)
on delete set default on delete set default);
# 2 on update clauses, illegal
--error ER_PARSE_ERROR
create table t_34455 (
a int not null,
foreign key (a) references t3 (a)
on update set default on update set default);
create table t_34455 (a int not null);
# 2 match clauses, illegal
--error ER_PARSE_ERROR
alter table t_34455
add foreign key (a) references t3 (a) match full match partial);
# match after on delete, illegal
--error ER_PARSE_ERROR
alter table t_34455
add foreign key (a) references t3 (a) on delete set default match full);
# match after on update, illegal
--error ER_PARSE_ERROR
alter table t_34455
add foreign key (a) references t3 (a) on update set default match full);
# 2 on delete clauses, illegal
--error ER_PARSE_ERROR
alter table t_34455
add foreign key (a) references t3 (a)
on delete set default on delete set default);
# 2 on update clauses, illegal
--error ER_PARSE_ERROR
alter table t_34455
add foreign key (a) references t3 (a)
on update set default on update set default);
drop table t_34455;

View File

@ -726,3 +726,48 @@ SELECT Polygon(1234512,'');
SELECT Polygon(12345123,'');
--echo End of 5.1 tests
#
# Bug #50574 5.5.x allows spatial indexes on non-spatial
# columns, causing crashes!
#
--error ER_SPATIAL_MUST_HAVE_GEOM_COL
CREATE TABLE t1(
col0 BINARY NOT NULL,
col2 TIMESTAMP,
SPATIAL INDEX i1 (col0)
) ENGINE=MyISAM;
# Test other ways to add indices
CREATE TABLE t1 (
col0 BINARY NOT NULL,
col2 TIMESTAMP
) ENGINE=MyISAM;
--error ER_SPATIAL_MUST_HAVE_GEOM_COL
CREATE SPATIAL INDEX idx0 ON t1(col0);
--error ER_SPATIAL_MUST_HAVE_GEOM_COL
ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
CREATE TABLE t2 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 POINT
);
--error ER_WRONG_ARGUMENTS
CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
--error ER_WRONG_ARGUMENTS
CREATE TABLE t3 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 LINESTRING,
SPATIAL INDEX i1 (col1, col2)
);
# cleanup
DROP TABLE t1;
DROP TABLE t2;

View File

@ -1166,3 +1166,22 @@ SELECT (SUM(DISTINCT a) + MAX(b)) FROM t2 GROUP BY a;
DROP TABLE t1,t2;
--echo # end of WL#3220 tests
--echo #
--echo # Bug#50539: Wrong result when loose index scan is used for an aggregate
--echo # function with distinct
--echo #
CREATE TABLE t1 (
f1 int(11) NOT NULL DEFAULT '0',
f2 char(1) NOT NULL DEFAULT '',
PRIMARY KEY (f1,f2)
) ;
insert into t1 values(1,'A'),(1 , 'B'), (1, 'C'), (2, 'A'),
(3, 'A'), (3, 'B'), (3, 'C'), (3, 'D');
SELECT f1, COUNT(DISTINCT f2) FROM t1 GROUP BY f1;
explain SELECT f1, COUNT(DISTINCT f2) FROM t1 GROUP BY f1;
drop table t1;
--echo # End of test#50539.

View File

@ -5,8 +5,7 @@
# Test of ipv4 (127.0.0.1) in ipv6 format
# Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding opt file).
#
# Can't be tested with windows due to mixed format like 0::0000:FFFF:127.0.0.1
--source include/not_windows.inc
--source include/have_ipv4_mapped.inc
# Can't be tested with embedded server
--source include/not_embedded.inc

View File

@ -1 +0,0 @@
--skip-name-resolve --bind-address=0.0.0.0

View File

@ -1,31 +0,0 @@
# Copyright (C) 2009 SUN Microsystems
# All rights reserved. Use is subject to license terms.
# Author: Horst Hunger
# Nov. 19, 2009
# Test of ipv4 (127.0.0.1) in ipv6 format
# Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding opt file).
#
# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1
--source include/windows.inc
# Can't be tested with embedded server
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
echo =============Test of '127.0.0.1' (IPv4) ===========================;
let $IPv6= 127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '::1' ========================;
let $IPv6= ::1;
--echo connect (con1, $IPv6, root, , test, MASTER_MYPORT);
--disable_query_log
--error 2003,2006
connect (con1, $IPv6, root, , test, $MASTER_MYPORT);
--enable_query_log
connection default;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -6,9 +6,6 @@
# Options: --skip-name-resolve, --bind-address=:: (see corresponding opt file).
#
--source include/check_ipv6.inc
# Can't be tested with windows due to the mixed format like 0:0:0:0:0:FFFF:127.0.0.1
--source include/not_windows.inc
# Can't be tested with embedded server
--source include/not_embedded.inc
@ -35,45 +32,5 @@ let $IPv6= 0:0:0:0:0:0:0:1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '127.0.0.1' (IPv4) ===========================;
let $IPv6= 127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1' ===================;
let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0000:0000:0000:0000:0000:FFFF:127.0.0.1' ====;
let $IPv6= 0000:0000:0000:0000:0000:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0000:0000:0:0000:FFFF:127.0.0.1' ====;
let $IPv6= 0:0000:0000:0:0000:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0::0000:FFFF:127.0.0.1' ====;
let $IPv6= 0::0000:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1/96' ================;
let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1/96;
#--source include/ipv6_clients.inc
#--source include/ipv6.inc
echo =============Test of '::FFFF:127.0.0.1' ===========================;
let $IPv6= ::FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '::FFFF:127.0.0.1/96' ========================;
let $IPv6= ::FFFF:127.0.0.1/96;
#--source include/ipv6_clients.inc
#--source include/ipv6.inc
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1 +0,0 @@
--skip-name-resolve --bind-address=::

View File

@ -1,39 +0,0 @@
# Copyright (C) 2009 SUN Microsystems
# All rights reserved. Use is subject to license terms.
# Author: Horst Hunger
# Nov. 19, 2009
# Test of ipv6 format
# Options: --skip-name-resolve, --bind-address=:: (see corresponding opt file).
#
--source include/check_ipv6.inc
# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1
--source include/windows.inc
# Can't be tested with embedded server
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
echo =============Test of '::1' ========================================;
let $IPv6= ::1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '::1/128' ====================================;
let $IPv6= ::1/128;
#--source include/ipv6_clients.inc
#--source include/ipv6.inc
echo =============Test of '0000:0000:0000:0000:0000:0000:0000:0001' ====;
let $IPv6= 0000:0000:0000:0000:0000:0000:0000:0001;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0:0:0:0:0:0:1' ============================;
let $IPv6= 0:0:0:0:0:0:0:1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1,18 @@
#
# Test for show profiles
# No meaningful check is possible.
# So it only checks that SET profiling is possible and
# that SHOW PROFILES, SHOW PROFILE FOR QUERY and SHOW PROFILE CPU FOR QUERY
# do not cause syntax errors. It also increases code coverage for sql_profile.cc
--source include/have_profiling.inc
SET profiling = 1;
SELECT 1;
--replace_column 2 #
SHOW PROFILES;
--disable_result_log
SHOW PROFILE FOR QUERY 1;
SHOW PROFILE CPU FOR QUERY 1;
--enable_result_log
SET profiling = 0;