mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge trift2.:/MySQL/M50/mysql-5.0
into trift2.:/MySQL/M50/push-5.0
This commit is contained in:
@ -43,7 +43,9 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
|
||||
|
||||
dist-hook:
|
||||
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
|
||||
$(distdir)/std_data $(distdir)/lib
|
||||
$(distdir)/std_data \
|
||||
$(distdir)/std_data/ndb_backup50_data_be $(distdir)/std_data/ndb_backup50_data_le \
|
||||
$(distdir)/lib
|
||||
-$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t
|
||||
$(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t
|
||||
-$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t
|
||||
@ -62,6 +64,8 @@ dist-hook:
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_be/BACKUP* $(distdir)/std_data/ndb_backup50_data_be
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_le/BACKUP* $(distdir)/std_data/ndb_backup50_data_le
|
||||
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
|
||||
-rm -rf `find $(distdir)/suite -type d -name SCCS`
|
||||
|
||||
@ -71,6 +75,8 @@ install-data-local:
|
||||
$(DESTDIR)$(testdir)/r \
|
||||
$(DESTDIR)$(testdir)/include \
|
||||
$(DESTDIR)$(testdir)/std_data \
|
||||
$(DESTDIR)$(testdir)/std_data/ndb_backup50_data_be \
|
||||
$(DESTDIR)$(testdir)/std_data/ndb_backup50_data_le \
|
||||
$(DESTDIR)$(testdir)/lib
|
||||
$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir)
|
||||
-$(INSTALL_DATA) $(srcdir)/t/*.def $(DESTDIR)$(testdir)/t
|
||||
@ -95,6 +101,8 @@ install-data-local:
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_be/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_be
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_le/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_le
|
||||
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
|
||||
for f in `(cd $(srcdir); find suite -type f | grep -v SCCS)`; \
|
||||
do \
|
||||
|
@ -26,3 +26,18 @@ select 1 # The rest of the row will be ignored
|
||||
1
|
||||
1
|
||||
/* line with only comment */;
|
||||
drop table if exists table_28779;
|
||||
create table table_28779 (a int);
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*' AND b = 'bar'' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';*";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*' AND b = 'bar';*' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;*";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';*' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!98765' AND b = 'bar'' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';*";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!98765' AND b = 'bar';*' at line 1
|
||||
drop table table_28779;
|
||||
|
@ -183,6 +183,17 @@ select @a;
|
||||
@a
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
`date` date ,
|
||||
`time` time ,
|
||||
`seq` int(10) unsigned NOT NULL auto_increment,
|
||||
PRIMARY KEY (`seq`),
|
||||
KEY `seq` (`seq`),
|
||||
KEY `time` (`time`),
|
||||
KEY `date` (`date`)
|
||||
);
|
||||
DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1 (a int not null,b int not null);
|
||||
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
|
||||
@ -223,3 +234,40 @@ ERROR 42S22: Unknown column 't2.x' in 'order clause'
|
||||
DELETE FROM t1 ORDER BY (SELECT x);
|
||||
ERROR 42S22: Unknown column 'x' in 'field list'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
a INT
|
||||
);
|
||||
CREATE DATABASE db1;
|
||||
CREATE TABLE db1.t1 (
|
||||
a INT
|
||||
);
|
||||
INSERT INTO db1.t1 (a) SELECT * FROM t1;
|
||||
CREATE DATABASE db2;
|
||||
CREATE TABLE db2.t1 (
|
||||
a INT
|
||||
);
|
||||
INSERT INTO db2.t1 (a) SELECT * FROM t2;
|
||||
DELETE FROM t1 alias USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING t1, t2 alias WHERE t1.a = alias.a' at line 1
|
||||
DELETE FROM alias USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
DELETE FROM t1, alias USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
DELETE FROM t1, t2 USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
ERROR 42S02: Unknown table 't2' in MULTI DELETE
|
||||
DELETE FROM db1.t1 alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a' at line 1
|
||||
DELETE FROM alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
ERROR 42S02: Unknown table 'alias' in MULTI DELETE
|
||||
DELETE FROM db2.alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
DELETE FROM t1 USING t1 WHERE a = 1;
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DELETE FROM t1 alias USING t1 alias WHERE a = 2;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING t1 alias WHERE a = 2' at line 1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DROP TABLE t1, t2;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
|
@ -526,10 +526,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 Using index
|
||||
EXPLAIN SELECT a,b FROM t1 GROUP BY a,b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
CREATE TABLE t2(a INT, b INT NOT NULL, c INT NOT NULL, d INT,
|
||||
PRIMARY KEY (a,b));
|
||||
INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
|
||||
@ -554,7 +554,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
CREATE UNIQUE INDEX c_b_unq ON t2 (c,b);
|
||||
EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
DROP TABLE t1,t2;
|
||||
create table t1 (id int, dsc varchar(50));
|
||||
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
|
||||
|
@ -1064,3 +1064,52 @@ select t1.f1,t.* from t1, t1 t group by 1;
|
||||
ERROR 42000: 'test.t.f1' isn't in GROUP BY
|
||||
drop table t1;
|
||||
SET SQL_MODE = '';
|
||||
CREATE TABLE t1(
|
||||
a INT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL,
|
||||
d INT,
|
||||
UNIQUE KEY (c,b)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b,d;
|
||||
c b d
|
||||
1 1 50
|
||||
3 1 4
|
||||
3 2 40
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
|
||||
c b d
|
||||
1 1 50
|
||||
3 2 40
|
||||
3 1 4
|
||||
EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
SELECT c,b,d FROM t1 ORDER BY c,b,d;
|
||||
c b d
|
||||
1 1 50
|
||||
3 1 4
|
||||
3 2 40
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b;
|
||||
c b d
|
||||
1 1 50
|
||||
3 1 4
|
||||
3 2 40
|
||||
EXPLAIN SELECT c,b FROM t1 GROUP BY c,b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL c 8 NULL 3 Using index
|
||||
SELECT c,b FROM t1 GROUP BY c,b;
|
||||
c b
|
||||
1 1
|
||||
3 1
|
||||
3 2
|
||||
DROP TABLE t1;
|
||||
|
@ -489,3 +489,16 @@ handler t1 open;
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
--> client 1
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
create table t1 (a int);
|
||||
handler t1 open as t1_alias;
|
||||
handler t1_alias read a next;
|
||||
ERROR HY000: Key 'a' doesn't exist in table 't1_alias'
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
ERROR 42S22: Unknown column 'inexistent' in 'field list'
|
||||
handler t1_alias read a next;
|
||||
ERROR HY000: Key 'a' doesn't exist in table 't1_alias'
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
ERROR 42S22: Unknown column 'inexistent' in 'field list'
|
||||
handler t1_alias close;
|
||||
drop table t1;
|
||||
|
@ -94,3 +94,14 @@ id x
|
||||
300 300
|
||||
commit;
|
||||
drop table t1, t2;
|
||||
End of 4.1 tests
|
||||
set storage_engine=innodb;
|
||||
drop table if exists a;
|
||||
drop table if exists A;
|
||||
create table A (c int);
|
||||
insert into A (c) values (0);
|
||||
create table a as select * from A;
|
||||
drop table A;
|
||||
drop table if exists a;
|
||||
set storage_engine=default;
|
||||
End of 5.0 tests.
|
||||
|
@ -1065,4 +1065,53 @@ a b
|
||||
ROLLBACK;
|
||||
ROLLBACK;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(
|
||||
a INT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL,
|
||||
d INT,
|
||||
UNIQUE KEY (c,b)
|
||||
) engine=innodb;
|
||||
INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b,d;
|
||||
c b d
|
||||
1 1 50
|
||||
3 1 4
|
||||
3 2 40
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
|
||||
c b d
|
||||
1 1 50
|
||||
3 1 4
|
||||
3 2 40
|
||||
EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
SELECT c,b,d FROM t1 ORDER BY c,b,d;
|
||||
c b d
|
||||
1 1 50
|
||||
3 1 4
|
||||
3 2 40
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL c 8 NULL 3
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b;
|
||||
c b d
|
||||
1 1 50
|
||||
3 1 4
|
||||
3 2 40
|
||||
EXPLAIN SELECT c,b FROM t1 GROUP BY c,b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL c 8 NULL 3 Using index
|
||||
SELECT c,b FROM t1 GROUP BY c,b;
|
||||
c b
|
||||
1 1
|
||||
3 1
|
||||
3 2
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -176,4 +176,6 @@ ERROR at line 1: DELIMITER cannot contain a backslash character
|
||||
ERROR at line 1: DELIMITER cannot contain a backslash character
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
End of 5.0 tests
|
||||
|
4
mysql-test/r/mysqldump-compat.result
Normal file
4
mysql-test/r/mysqldump-compat.result
Normal file
@ -0,0 +1,4 @@
|
||||
CREATE DATABASE mysqldump_30126;
|
||||
USE mysqldump_30126;
|
||||
CREATE TABLE t1 (c1 int);
|
||||
DROP DATABASE mysqldump_30126;
|
8
mysql-test/r/ndb_bug26793.result
Normal file
8
mysql-test/r/ndb_bug26793.result
Normal file
@ -0,0 +1,8 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE `test` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
`t` VARCHAR( 10 ) NOT NULL
|
||||
) ENGINE = ndbcluster;
|
||||
GRANT USAGE ON *.* TO user1@localhost IDENTIFIED BY 'pass';
|
||||
DROP TABLE `test`.`test`;
|
||||
drop user user1@localhost;
|
@ -405,3 +405,22 @@ a b
|
||||
1 1
|
||||
10 10
|
||||
drop table t2;
|
||||
create table t1 (id int primary key) engine ndb;
|
||||
insert into t1 values (1), (2), (3);
|
||||
create table t2 (id int primary key) engine ndb;
|
||||
insert into t2 select id from t1;
|
||||
create trigger kaboom after delete on t1
|
||||
for each row begin
|
||||
delete from t2 where id=old.id;
|
||||
end|
|
||||
select * from t1 order by id;
|
||||
id
|
||||
1
|
||||
2
|
||||
3
|
||||
delete from t1 where id in (1,2);
|
||||
select * from t2 order by id;
|
||||
id
|
||||
3
|
||||
drop trigger kaboom;
|
||||
drop table t1;
|
||||
|
200
mysql-test/r/ndb_restore_different_endian_data.result
Normal file
200
mysql-test/r/ndb_restore_different_endian_data.result
Normal file
@ -0,0 +1,200 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS t_num,t_datetime,t_string_1,t_string_2,t_gis;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
t_gis
|
||||
t_string_1
|
||||
t_num
|
||||
t_string_2
|
||||
t_datetime
|
||||
SHOW CREATE TABLE t_num;
|
||||
Table Create Table
|
||||
t_num CREATE TABLE `t_num` (
|
||||
`t_pk` int(11) NOT NULL,
|
||||
`t_bit` bit(64) default NULL,
|
||||
`t_tinyint` tinyint(4) default NULL,
|
||||
`t_bool` tinyint(1) default NULL,
|
||||
`t_smallint` smallint(6) default NULL,
|
||||
`t_mediumint` mediumint(9) default NULL,
|
||||
`t_int` int(11) default NULL,
|
||||
`t_bigint` bigint(20) default NULL,
|
||||
`t_float` float default NULL,
|
||||
`t_double` double default NULL,
|
||||
`t_decimal` decimal(37,16) default NULL,
|
||||
PRIMARY KEY (`t_pk`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t_datetime;
|
||||
Table Create Table
|
||||
t_datetime CREATE TABLE `t_datetime` (
|
||||
`t_pk` int(11) NOT NULL,
|
||||
`t_date` date default NULL,
|
||||
`t_datetime` datetime default NULL,
|
||||
`t_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`t_time` time default NULL,
|
||||
`t_year` year(4) default NULL,
|
||||
PRIMARY KEY (`t_pk`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t_string_1;
|
||||
Table Create Table
|
||||
t_string_1 CREATE TABLE `t_string_1` (
|
||||
`t_pk` int(11) NOT NULL,
|
||||
`t_char` char(255) default NULL,
|
||||
`t_varchar` varchar(655) default NULL,
|
||||
`t_binary` binary(255) default NULL,
|
||||
`t_varbinary` varbinary(6553) default NULL,
|
||||
PRIMARY KEY (`t_pk`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t_string_2;
|
||||
Table Create Table
|
||||
t_string_2 CREATE TABLE `t_string_2` (
|
||||
`t_pk` int(11) NOT NULL,
|
||||
`t_tinyblob` tinyblob,
|
||||
`t_tinytext` tinytext,
|
||||
`t_blob` blob,
|
||||
`t_text` text,
|
||||
`t_mediumblob` mediumblob,
|
||||
`t_mediumtext` mediumtext,
|
||||
`t_longblob` longblob,
|
||||
`t_longtext` longtext,
|
||||
`t_enum` enum('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007') NOT NULL default '001001',
|
||||
`t_set` set('a','B') default NULL,
|
||||
PRIMARY KEY (`t_pk`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t_gis;
|
||||
Table Create Table
|
||||
t_gis CREATE TABLE `t_gis` (
|
||||
`t_pk` int(11) NOT NULL,
|
||||
`t_point` point default NULL,
|
||||
`t_linestring` linestring default NULL,
|
||||
`t_polygon` polygon default NULL,
|
||||
`t_multipoint` multipoint default NULL,
|
||||
`t_multilinestring` multilinestring default NULL,
|
||||
`t_multipolygon` multipolygon default NULL,
|
||||
`t_geometrycollection` geometrycollection default NULL,
|
||||
`t_geometry` geometry default NULL,
|
||||
PRIMARY KEY (`t_pk`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t_datetime;
|
||||
t_pk t_date t_datetime t_timestamp t_time t_year
|
||||
1 1998-01-01 2006-08-10 10:11:12 2002-10-29 16:51:06 19:38:34 2155
|
||||
SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num;
|
||||
t_pk hex(t_bit) t_tinyint t_bool t_smallint t_mediumint t_int t_bigint t_float t_double t_decimal
|
||||
1 AAAAAAAAAAAAAAAA 125 1 32765 8388606 2147483647 9223372036854775807 1e+20 1e+150 331.0000000000000000
|
||||
SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1;
|
||||
t_pk t_char t_varchar hex(t_binary) hex(t_varbinary)
|
||||
1 abcdefghijklmn abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn 612020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 4100
|
||||
SELECT * FROM t_string_2;
|
||||
t_pk t_tinyblob t_tinytext t_blob t_text t_mediumblob t_mediumtext t_longblob t_longtext t_enum t_set
|
||||
1 abcdefghijklmnabcdefghijklmn abcdefghijklmnabcdefghijklmn a123456789b123456789c123456789d123456789e123456789f123456789g123456789 a123456789b123456789c123456789d123456789e123456789f123456789g123456789 a123456789b123456789c123456789d123456789e123456789f123456789g123456789 a123456789b123456789c123456789d123456789e123456789f123456789g123456789 a123456789b123456789c123456789d123456789e123456789f123456789g123456789 a123456789b123456789c123456789d123456789e123456789f123456789g123456789 001001 a
|
||||
SELECT AsText(t_point), AsText(t_linestring),AsText(t_polygon) FROM t_gis ORDER by t_pk;
|
||||
AsText(t_point) AsText(t_linestring) AsText(t_polygon)
|
||||
POINT(10 10) LINESTRING(10 10,20 10,20 20,10 20,10 10) POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
|
||||
POINT(10 20) LINESTRING(10 10,40 10) POLYGON((0 0,30 0,30 30,0 0))
|
||||
SELECT AsText(t_multipoint), AsText(t_multilinestring),AsText(t_multipolygon) FROM t_gis ORDER by t_pk;
|
||||
AsText(t_multipoint) AsText(t_multilinestring) AsText(t_multipolygon)
|
||||
MULTIPOINT(1 1,11 11,11 21,21 21) MULTILINESTRING((10 48,10 21,10 0)) MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
MULTIPOINT(3 6,4 10) MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
|
||||
SELECT AsText(t_geometrycollection), AsText(t_geometry) FROM t_gis ORDER by t_pk;
|
||||
AsText(t_geometrycollection) AsText(t_geometry)
|
||||
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
|
||||
DROP TABLE t_num,t_datetime,t_string_1,t_string_2,t_gis;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
t_gis
|
||||
t_string_1
|
||||
t_num
|
||||
t_string_2
|
||||
t_datetime
|
||||
SHOW CREATE TABLE t_num;
|
||||
Table Create Table
|
||||
t_num CREATE TABLE `t_num` (
|
||||
`t_pk` int(11) NOT NULL,
|
||||
`t_bit` bit(64) default NULL,
|
||||
`t_tinyint` tinyint(4) default NULL,
|
||||
`t_bool` tinyint(1) default NULL,
|
||||
`t_smallint` smallint(6) default NULL,
|
||||
`t_mediumint` mediumint(9) default NULL,
|
||||
`t_int` int(11) default NULL,
|
||||
`t_bigint` bigint(20) default NULL,
|
||||
`t_float` float default NULL,
|
||||
`t_double` double default NULL,
|
||||
`t_decimal` decimal(37,16) default NULL,
|
||||
PRIMARY KEY (`t_pk`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t_datetime;
|
||||
Table Create Table
|
||||
t_datetime CREATE TABLE `t_datetime` (
|
||||
`t_pk` int(11) NOT NULL,
|
||||
`t_date` date default NULL,
|
||||
`t_datetime` datetime default NULL,
|
||||
`t_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`t_time` time default NULL,
|
||||
`t_year` year(4) default NULL,
|
||||
PRIMARY KEY (`t_pk`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t_string_1;
|
||||
Table Create Table
|
||||
t_string_1 CREATE TABLE `t_string_1` (
|
||||
`t_pk` int(11) NOT NULL,
|
||||
`t_char` char(255) default NULL,
|
||||
`t_varchar` varchar(655) default NULL,
|
||||
`t_binary` binary(255) default NULL,
|
||||
`t_varbinary` varbinary(6553) default NULL,
|
||||
PRIMARY KEY (`t_pk`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t_string_2;
|
||||
Table Create Table
|
||||
t_string_2 CREATE TABLE `t_string_2` (
|
||||
`t_pk` int(11) NOT NULL,
|
||||
`t_tinyblob` tinyblob,
|
||||
`t_tinytext` tinytext,
|
||||
`t_blob` blob,
|
||||
`t_text` text,
|
||||
`t_mediumblob` mediumblob,
|
||||
`t_mediumtext` mediumtext,
|
||||
`t_longblob` longblob,
|
||||
`t_longtext` longtext,
|
||||
`t_enum` enum('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007') NOT NULL default '001001',
|
||||
`t_set` set('a','B') default NULL,
|
||||
PRIMARY KEY (`t_pk`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t_gis;
|
||||
Table Create Table
|
||||
t_gis CREATE TABLE `t_gis` (
|
||||
`t_pk` int(11) NOT NULL,
|
||||
`t_point` point default NULL,
|
||||
`t_linestring` linestring default NULL,
|
||||
`t_polygon` polygon default NULL,
|
||||
`t_multipoint` multipoint default NULL,
|
||||
`t_multilinestring` multilinestring default NULL,
|
||||
`t_multipolygon` multipolygon default NULL,
|
||||
`t_geometrycollection` geometrycollection default NULL,
|
||||
`t_geometry` geometry default NULL,
|
||||
PRIMARY KEY (`t_pk`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t_datetime;
|
||||
t_pk t_date t_datetime t_timestamp t_time t_year
|
||||
1 1998-01-01 2006-08-10 10:11:12 2002-10-29 16:51:06 19:38:34 2155
|
||||
SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num;
|
||||
t_pk hex(t_bit) t_tinyint t_bool t_smallint t_mediumint t_int t_bigint t_float t_double t_decimal
|
||||
1 AAAAAAAAAAAAAAAA 125 1 32765 8388606 2147483647 9223372036854775807 1e+20 1e+150 331.0000000000000000
|
||||
SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1;
|
||||
t_pk t_char t_varchar hex(t_binary) hex(t_varbinary)
|
||||
1 abcdefghijklmn abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn 612020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 4100
|
||||
SELECT * FROM t_string_2;
|
||||
t_pk t_tinyblob t_tinytext t_blob t_text t_mediumblob t_mediumtext t_longblob t_longtext t_enum t_set
|
||||
1 abcdefghijklmnabcdefghijklmn abcdefghijklmnabcdefghijklmn a123456789b123456789c123456789d123456789e123456789f123456789g123456789 a123456789b123456789c123456789d123456789e123456789f123456789g123456789 a123456789b123456789c123456789d123456789e123456789f123456789g123456789 a123456789b123456789c123456789d123456789e123456789f123456789g123456789 a123456789b123456789c123456789d123456789e123456789f123456789g123456789 a123456789b123456789c123456789d123456789e123456789f123456789g123456789 001001 a
|
||||
SELECT AsText(t_point), AsText(t_linestring),AsText(t_polygon) FROM t_gis ORDER by t_pk;
|
||||
AsText(t_point) AsText(t_linestring) AsText(t_polygon)
|
||||
POINT(10 10) LINESTRING(10 10,20 10,20 20,10 20,10 10) POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
|
||||
POINT(10 20) LINESTRING(10 10,40 10) POLYGON((0 0,30 0,30 30,0 0))
|
||||
SELECT AsText(t_multipoint), AsText(t_multilinestring),AsText(t_multipolygon) FROM t_gis ORDER by t_pk;
|
||||
AsText(t_multipoint) AsText(t_multilinestring) AsText(t_multipolygon)
|
||||
MULTIPOINT(1 1,11 11,11 21,21 21) MULTILINESTRING((10 48,10 21,10 0)) MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
MULTIPOINT(3 6,4 10) MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
|
||||
SELECT AsText(t_geometrycollection), AsText(t_geometry) FROM t_gis ORDER by t_pk;
|
||||
AsText(t_geometrycollection) AsText(t_geometry)
|
||||
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
|
||||
DROP TABLE t_num,t_datetime,t_string_1,t_string_2,t_gis;
|
747
mysql-test/r/parser_precedence.result
Normal file
747
mysql-test/r/parser_precedence.result
Normal file
@ -0,0 +1,747 @@
|
||||
drop table if exists t1_30237_bool;
|
||||
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
||||
insert into t1_30237_bool values
|
||||
(FALSE, FALSE, FALSE),
|
||||
(FALSE, FALSE, NULL),
|
||||
(FALSE, FALSE, TRUE),
|
||||
(FALSE, NULL, FALSE),
|
||||
(FALSE, NULL, NULL),
|
||||
(FALSE, NULL, TRUE),
|
||||
(FALSE, TRUE, FALSE),
|
||||
(FALSE, TRUE, NULL),
|
||||
(FALSE, TRUE, TRUE),
|
||||
(NULL, FALSE, FALSE),
|
||||
(NULL, FALSE, NULL),
|
||||
(NULL, FALSE, TRUE),
|
||||
(NULL, NULL, FALSE),
|
||||
(NULL, NULL, NULL),
|
||||
(NULL, NULL, TRUE),
|
||||
(NULL, TRUE, FALSE),
|
||||
(NULL, TRUE, NULL),
|
||||
(NULL, TRUE, TRUE),
|
||||
(TRUE, FALSE, FALSE),
|
||||
(TRUE, FALSE, NULL),
|
||||
(TRUE, FALSE, TRUE),
|
||||
(TRUE, NULL, FALSE),
|
||||
(TRUE, NULL, NULL),
|
||||
(TRUE, NULL, TRUE),
|
||||
(TRUE, TRUE, FALSE),
|
||||
(TRUE, TRUE, NULL),
|
||||
(TRUE, TRUE, TRUE) ;
|
||||
Testing OR, XOR, AND
|
||||
select A, B, A OR B, A XOR B, A AND B
|
||||
from t1_30237_bool where C is null order by A, B;
|
||||
A B A OR B A XOR B A AND B
|
||||
NULL NULL NULL NULL NULL
|
||||
NULL 0 NULL NULL 0
|
||||
NULL 1 1 NULL NULL
|
||||
0 NULL NULL NULL 0
|
||||
0 0 0 0 0
|
||||
0 1 1 1 0
|
||||
1 NULL 1 NULL NULL
|
||||
1 0 1 1 0
|
||||
1 1 1 0 1
|
||||
Testing that OR is associative
|
||||
select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) OR C A OR (B OR C) A OR B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 1 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 1 1 1
|
||||
NULL 1 NULL 1 1 1
|
||||
NULL 1 0 1 1 1
|
||||
NULL 1 1 1 1 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 1 1 1
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL 1 1 1
|
||||
0 1 0 1 1 1
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL 1 1 1
|
||||
1 NULL 0 1 1 1
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL 1 1 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 1 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A OR B) OR C) != (A OR (B OR C));
|
||||
count(*)
|
||||
0
|
||||
Testing that XOR is associative
|
||||
select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) XOR C A XOR (B XOR C) A XOR B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 1 1 1
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 1 1 1
|
||||
1 0 1 0 0 0
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) XOR C) != (A XOR (B XOR C));
|
||||
count(*)
|
||||
0
|
||||
Testing that AND is associative
|
||||
select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) AND C A AND (B AND C) A AND B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 0 0
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL 0 0 0
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 0 0 0
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 0 0
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL 0 0 0
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 0 0 0
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL 0 0 0
|
||||
0 1 0 0 0 0
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 0 0 0
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL 0 0 0
|
||||
1 0 0 0 0 0
|
||||
1 0 1 0 0 0
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) AND C) != (A AND (B AND C));
|
||||
count(*)
|
||||
0
|
||||
Testing that AND has precedence over OR
|
||||
select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) AND C A OR (B AND C) A OR B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 NULL NULL
|
||||
NULL 1 1 1 1 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL 1 1
|
||||
1 NULL 0 0 1 1
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 0 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL NULL 1 1
|
||||
1 1 0 0 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B AND C)) != (A OR B AND C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) OR C A AND (B OR C) A AND B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 NULL 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 1 NULL 1
|
||||
0 NULL NULL NULL 0 NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 1 0 1
|
||||
0 0 NULL NULL 0 NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 0 1
|
||||
0 1 NULL NULL 0 NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 0 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 0 0 0
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 1 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) OR C) != (A AND B OR C);
|
||||
count(*)
|
||||
0
|
||||
Testing that AND has precedence over XOR
|
||||
select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) AND C A XOR (B AND C) A XOR B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 NULL NULL
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 0 1 1
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 0 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 0 NULL NULL
|
||||
1 1 0 0 1 1
|
||||
1 1 1 0 0 0
|
||||
select count(*) from t1_30237_bool
|
||||
where (A XOR (B AND C)) != (A XOR B AND C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) XOR C A AND (B XOR C) A AND B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 NULL 0 NULL
|
||||
0 NULL NULL NULL 0 NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 1 0 1
|
||||
0 0 NULL NULL 0 NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 0 1
|
||||
0 1 NULL NULL 0 NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 0 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 0 0 0
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 1 1 1
|
||||
1 1 1 0 0 0
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) XOR C) != (A AND B XOR C);
|
||||
count(*)
|
||||
0
|
||||
Testing that XOR has precedence over OR
|
||||
select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) OR C A XOR (B OR C) A XOR B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 NULL 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 1 NULL 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 1 1 1
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL 1 1 1
|
||||
0 1 0 1 1 1
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 1 0 1
|
||||
1 0 NULL 1 NULL 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 1 0 1
|
||||
1 1 NULL NULL 0 NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 0 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) OR C) != (A XOR B OR C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) XOR C A OR (B XOR C) A OR B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 NULL 1 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 1 1 1
|
||||
NULL 1 1 0 NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 1 1 1
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL 1 1
|
||||
1 NULL 0 1 1 1
|
||||
1 NULL 1 0 1 1
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 0 1 1
|
||||
1 1 NULL NULL 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 0 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B XOR C)) != (A OR B XOR C);
|
||||
count(*)
|
||||
0
|
||||
drop table t1_30237_bool;
|
||||
Testing that NOT has precedence over OR
|
||||
select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
|
||||
(NOT FALSE) OR TRUE NOT (FALSE OR TRUE) NOT FALSE OR TRUE
|
||||
1 0 1
|
||||
Testing that NOT has precedence over XOR
|
||||
select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
|
||||
(NOT FALSE) XOR FALSE NOT (FALSE XOR FALSE) NOT FALSE XOR FALSE
|
||||
1 1 1
|
||||
Testing that NOT has precedence over AND
|
||||
select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
|
||||
(NOT FALSE) AND FALSE NOT (FALSE AND FALSE) NOT FALSE AND FALSE
|
||||
0 1 0
|
||||
Testing that NOT is associative
|
||||
select NOT NOT TRUE, NOT NOT NOT FALSE;
|
||||
NOT NOT TRUE NOT NOT NOT FALSE
|
||||
1 1
|
||||
Testing that IS has precedence over NOT
|
||||
select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
|
||||
(NOT NULL) IS TRUE NOT (NULL IS TRUE) NOT NULL IS TRUE
|
||||
0 1 1
|
||||
select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
|
||||
(NOT NULL) IS NOT TRUE NOT (NULL IS NOT TRUE) NOT NULL IS NOT TRUE
|
||||
1 0 0
|
||||
select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
|
||||
(NOT NULL) IS FALSE NOT (NULL IS FALSE) NOT NULL IS FALSE
|
||||
0 1 1
|
||||
select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
|
||||
(NOT NULL) IS NOT FALSE NOT (NULL IS NOT FALSE) NOT NULL IS NOT FALSE
|
||||
1 0 0
|
||||
select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
|
||||
(NOT TRUE) IS UNKNOWN NOT (TRUE IS UNKNOWN) NOT TRUE IS UNKNOWN
|
||||
0 1 1
|
||||
select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
|
||||
(NOT TRUE) IS NOT UNKNOWN NOT (TRUE IS NOT UNKNOWN) NOT TRUE IS NOT UNKNOWN
|
||||
1 0 0
|
||||
select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
|
||||
(NOT TRUE) IS NULL NOT (TRUE IS NULL) NOT TRUE IS NULL
|
||||
0 1 1
|
||||
select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
|
||||
(NOT TRUE) IS NOT NULL NOT (TRUE IS NOT NULL) NOT TRUE IS NOT NULL
|
||||
1 0 0
|
||||
Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
|
||||
select TRUE IS TRUE IS TRUE IS TRUE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS TRUE IS TRUE' at line 1
|
||||
select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NOT TRUE IS NOT TRUE' at line 1
|
||||
select NULL IS FALSE IS FALSE IS FALSE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS FALSE IS FALSE' at line 1
|
||||
select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NOT FALSE IS NOT FALSE' at line 1
|
||||
select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS UNKNOWN IS UNKNOWN' at line 1
|
||||
select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NOT UNKNOWN IS NOT UNKNOWN' at line 1
|
||||
Testing that IS [NOT] NULL predicates are associative
|
||||
select FALSE IS NULL IS NULL IS NULL;
|
||||
FALSE IS NULL IS NULL IS NULL
|
||||
0
|
||||
select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
|
||||
TRUE IS NOT NULL IS NOT NULL IS NOT NULL
|
||||
1
|
||||
Testing that comparison operators are left associative
|
||||
select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
|
||||
1 <=> 2 <=> 2 (1 <=> 2) <=> 2 1 <=> (2 <=> 2)
|
||||
0 0 1
|
||||
select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
|
||||
1 = 2 = 2 (1 = 2) = 2 1 = (2 = 2)
|
||||
0 0 1
|
||||
select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
|
||||
1 != 2 != 3 (1 != 2) != 3 1 != (2 != 3)
|
||||
1 1 0
|
||||
select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
|
||||
1 <> 2 <> 3 (1 <> 2) <> 3 1 <> (2 <> 3)
|
||||
1 1 0
|
||||
select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
|
||||
1 < 2 < 3 (1 < 2) < 3 1 < (2 < 3)
|
||||
1 1 0
|
||||
select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
|
||||
3 <= 2 <= 1 (3 <= 2) <= 1 3 <= (2 <= 1)
|
||||
1 1 0
|
||||
select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
|
||||
1 > 2 > 3 (1 > 2) > 3 1 > (2 > 3)
|
||||
0 0 1
|
||||
select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
|
||||
1 >= 2 >= 3 (1 >= 2) >= 3 1 >= (2 >= 3)
|
||||
0 0 1
|
||||
Testing that | is associative
|
||||
select 0xF0 | 0x0F | 0x55, (0xF0 | 0x0F) | 0x55, 0xF0 | (0x0F | 0x55);
|
||||
0xF0 | 0x0F | 0x55 (0xF0 | 0x0F) | 0x55 0xF0 | (0x0F | 0x55)
|
||||
255 255 255
|
||||
Testing that & is associative
|
||||
select 0xF5 & 0x5F & 0x55, (0xF5 & 0x5F) & 0x55, 0xF5 & (0x5F & 0x55);
|
||||
0xF5 & 0x5F & 0x55 (0xF5 & 0x5F) & 0x55 0xF5 & (0x5F & 0x55)
|
||||
85 85 85
|
||||
Testing that << is left associative
|
||||
select 4 << 3 << 2, (4 << 3) << 2, 4 << (3 << 2);
|
||||
4 << 3 << 2 (4 << 3) << 2 4 << (3 << 2)
|
||||
128 128 16384
|
||||
Testing that >> is left associative
|
||||
select 256 >> 3 >> 2, (256 >> 3) >> 2, 256 >> (3 >> 2);
|
||||
256 >> 3 >> 2 (256 >> 3) >> 2 256 >> (3 >> 2)
|
||||
8 8 256
|
||||
Testing that & has precedence over |
|
||||
select 0xF0 & 0x0F | 0x55, (0xF0 & 0x0F) | 0x55, 0xF0 & (0x0F | 0x55);
|
||||
0xF0 & 0x0F | 0x55 (0xF0 & 0x0F) | 0x55 0xF0 & (0x0F | 0x55)
|
||||
85 85 80
|
||||
select 0x55 | 0xF0 & 0x0F, (0x55 | 0xF0) & 0x0F, 0x55 | (0xF0 & 0x0F);
|
||||
0x55 | 0xF0 & 0x0F (0x55 | 0xF0) & 0x0F 0x55 | (0xF0 & 0x0F)
|
||||
85 5 85
|
||||
Testing that << has precedence over |
|
||||
select 0x0F << 4 | 0x0F, (0x0F << 4) | 0x0F, 0x0F << (4 | 0x0F);
|
||||
0x0F << 4 | 0x0F (0x0F << 4) | 0x0F 0x0F << (4 | 0x0F)
|
||||
255 255 491520
|
||||
select 0x0F | 0x0F << 4, (0x0F | 0x0F) << 4, 0x0F | (0x0F << 4);
|
||||
0x0F | 0x0F << 4 (0x0F | 0x0F) << 4 0x0F | (0x0F << 4)
|
||||
255 240 255
|
||||
Testing that >> has precedence over |
|
||||
select 0xF0 >> 4 | 0xFF, (0xF0 >> 4) | 0xFF, 0xF0 >> (4 | 0xFF);
|
||||
0xF0 >> 4 | 0xFF (0xF0 >> 4) | 0xFF 0xF0 >> (4 | 0xFF)
|
||||
255 255 0
|
||||
select 0xFF | 0xF0 >> 4, (0xFF | 0xF0) >> 4, 0xFF | (0xF0 >> 4);
|
||||
0xFF | 0xF0 >> 4 (0xFF | 0xF0) >> 4 0xFF | (0xF0 >> 4)
|
||||
255 15 255
|
||||
Testing that << has precedence over &
|
||||
select 0x0F << 4 & 0xF0, (0x0F << 4) & 0xF0, 0x0F << (4 & 0xF0);
|
||||
0x0F << 4 & 0xF0 (0x0F << 4) & 0xF0 0x0F << (4 & 0xF0)
|
||||
240 240 15
|
||||
select 0xF0 & 0x0F << 4, (0xF0 & 0x0F) << 4, 0xF0 & (0x0F << 4);
|
||||
0xF0 & 0x0F << 4 (0xF0 & 0x0F) << 4 0xF0 & (0x0F << 4)
|
||||
240 0 240
|
||||
Testing that >> has precedence over &
|
||||
select 0xF0 >> 4 & 0x55, (0xF0 >> 4) & 0x55, 0xF0 >> (4 & 0x55);
|
||||
0xF0 >> 4 & 0x55 (0xF0 >> 4) & 0x55 0xF0 >> (4 & 0x55)
|
||||
5 5 15
|
||||
select 0x0F & 0xF0 >> 4, (0x0F & 0xF0) >> 4, 0x0F & (0xF0 >> 4);
|
||||
0x0F & 0xF0 >> 4 (0x0F & 0xF0) >> 4 0x0F & (0xF0 >> 4)
|
||||
15 0 15
|
||||
Testing that >> and << have the same precedence
|
||||
select 0xFF >> 4 << 2, (0xFF >> 4) << 2, 0xFF >> (4 << 2);
|
||||
0xFF >> 4 << 2 (0xFF >> 4) << 2 0xFF >> (4 << 2)
|
||||
60 60 0
|
||||
select 0x0F << 4 >> 2, (0x0F << 4) >> 2, 0x0F << (4 >> 2);
|
||||
0x0F << 4 >> 2 (0x0F << 4) >> 2 0x0F << (4 >> 2)
|
||||
60 60 30
|
||||
Testing that binary + is associative
|
||||
select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
|
||||
1 + 2 + 3 (1 + 2) + 3 1 + (2 + 3)
|
||||
6 6 6
|
||||
Testing that binary - is left associative
|
||||
select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
|
||||
1 - 2 - 3 (1 - 2) - 3 1 - (2 - 3)
|
||||
-4 -4 2
|
||||
Testing that binary + and binary - have the same precedence
|
||||
select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
|
||||
1 + 2 - 3 (1 + 2) - 3 1 + (2 - 3)
|
||||
0 0 0
|
||||
select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
|
||||
1 - 2 + 3 (1 - 2) + 3 1 - (2 + 3)
|
||||
2 2 -4
|
||||
Testing that binary + has precedence over |
|
||||
select 0xF0 + 0x0F | 0x55, (0xF0 + 0x0F) | 0x55, 0xF0 + (0x0F | 0x55);
|
||||
0xF0 + 0x0F | 0x55 (0xF0 + 0x0F) | 0x55 0xF0 + (0x0F | 0x55)
|
||||
255 255 335
|
||||
select 0x55 | 0xF0 + 0x0F, (0x55 | 0xF0) + 0x0F, 0x55 | (0xF0 + 0x0F);
|
||||
0x55 | 0xF0 + 0x0F (0x55 | 0xF0) + 0x0F 0x55 | (0xF0 + 0x0F)
|
||||
255 260 255
|
||||
Testing that binary + has precedence over &
|
||||
select 0xF0 + 0x0F & 0x55, (0xF0 + 0x0F) & 0x55, 0xF0 + (0x0F & 0x55);
|
||||
0xF0 + 0x0F & 0x55 (0xF0 + 0x0F) & 0x55 0xF0 + (0x0F & 0x55)
|
||||
85 85 245
|
||||
select 0x55 & 0xF0 + 0x0F, (0x55 & 0xF0) + 0x0F, 0x55 & (0xF0 + 0x0F);
|
||||
0x55 & 0xF0 + 0x0F (0x55 & 0xF0) + 0x0F 0x55 & (0xF0 + 0x0F)
|
||||
85 95 85
|
||||
Testing that binary + has precedence over <<
|
||||
select 2 + 3 << 4, (2 + 3) << 4, 2 + (3 << 4);
|
||||
2 + 3 << 4 (2 + 3) << 4 2 + (3 << 4)
|
||||
80 80 50
|
||||
select 3 << 4 + 2, (3 << 4) + 2, 3 << (4 + 2);
|
||||
3 << 4 + 2 (3 << 4) + 2 3 << (4 + 2)
|
||||
192 50 192
|
||||
Testing that binary + has precedence over >>
|
||||
select 4 + 3 >> 2, (4 + 3) >> 2, 4 + (3 >> 2);
|
||||
4 + 3 >> 2 (4 + 3) >> 2 4 + (3 >> 2)
|
||||
1 1 4
|
||||
select 3 >> 2 + 1, (3 >> 2) + 1, 3 >> (2 + 1);
|
||||
3 >> 2 + 1 (3 >> 2) + 1 3 >> (2 + 1)
|
||||
0 1 0
|
||||
Testing that binary - has precedence over |
|
||||
select 0xFF - 0x0F | 0x55, (0xFF - 0x0F) | 0x55, 0xFF - (0x0F | 0x55);
|
||||
0xFF - 0x0F | 0x55 (0xFF - 0x0F) | 0x55 0xFF - (0x0F | 0x55)
|
||||
245 245 160
|
||||
select 0x55 | 0xFF - 0xF0, (0x55 | 0xFF) - 0xF0, 0x55 | (0xFF - 0xF0);
|
||||
0x55 | 0xFF - 0xF0 (0x55 | 0xFF) - 0xF0 0x55 | (0xFF - 0xF0)
|
||||
95 15 95
|
||||
Testing that binary - has precedence over &
|
||||
select 0xFF - 0xF0 & 0x55, (0xFF - 0xF0) & 0x55, 0xFF - (0xF0 & 0x55);
|
||||
0xFF - 0xF0 & 0x55 (0xFF - 0xF0) & 0x55 0xFF - (0xF0 & 0x55)
|
||||
5 5 175
|
||||
select 0x55 & 0xFF - 0xF0, (0x55 & 0xFF) - 0xF0, 0x55 & (0xFF - 0xF0);
|
||||
0x55 & 0xFF - 0xF0 (0x55 & 0xFF) - 0xF0 0x55 & (0xFF - 0xF0)
|
||||
5 -155 5
|
||||
Testing that binary - has precedence over <<
|
||||
select 16 - 3 << 2, (16 - 3) << 2, 16 - (3 << 2);
|
||||
16 - 3 << 2 (16 - 3) << 2 16 - (3 << 2)
|
||||
52 52 4
|
||||
select 4 << 3 - 2, (4 << 3) - 2, 4 << (3 - 2);
|
||||
4 << 3 - 2 (4 << 3) - 2 4 << (3 - 2)
|
||||
8 30 8
|
||||
Testing that binary - has precedence over >>
|
||||
select 16 - 3 >> 2, (16 - 3) >> 2, 16 - (3 >> 2);
|
||||
16 - 3 >> 2 (16 - 3) >> 2 16 - (3 >> 2)
|
||||
3 3 16
|
||||
select 16 >> 3 - 2, (16 >> 3) - 2, 16 >> (3 - 2);
|
||||
16 >> 3 - 2 (16 >> 3) - 2 16 >> (3 - 2)
|
||||
8 0 8
|
||||
Testing that * is associative
|
||||
select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
|
||||
2 * 3 * 4 (2 * 3) * 4 2 * (3 * 4)
|
||||
24 24 24
|
||||
Testing that * has precedence over |
|
||||
select 2 * 0x40 | 0x0F, (2 * 0x40) | 0x0F, 2 * (0x40 | 0x0F);
|
||||
2 * 0x40 | 0x0F (2 * 0x40) | 0x0F 2 * (0x40 | 0x0F)
|
||||
143 143 158
|
||||
select 0x0F | 2 * 0x40, (0x0F | 2) * 0x40, 0x0F | (2 * 0x40);
|
||||
0x0F | 2 * 0x40 (0x0F | 2) * 0x40 0x0F | (2 * 0x40)
|
||||
143 960 143
|
||||
Testing that * has precedence over &
|
||||
select 2 * 0x40 & 0x55, (2 * 0x40) & 0x55, 2 * (0x40 & 0x55);
|
||||
2 * 0x40 & 0x55 (2 * 0x40) & 0x55 2 * (0x40 & 0x55)
|
||||
0 0 128
|
||||
select 0xF0 & 2 * 0x40, (0xF0 & 2) * 0x40, 0xF0 & (2 * 0x40);
|
||||
0xF0 & 2 * 0x40 (0xF0 & 2) * 0x40 0xF0 & (2 * 0x40)
|
||||
128 0 128
|
||||
Testing that * has precedence over <<
|
||||
select 5 * 3 << 4, (5 * 3) << 4, 5 * (3 << 4);
|
||||
5 * 3 << 4 (5 * 3) << 4 5 * (3 << 4)
|
||||
240 240 240
|
||||
select 2 << 3 * 4, (2 << 3) * 4, 2 << (3 * 4);
|
||||
2 << 3 * 4 (2 << 3) * 4 2 << (3 * 4)
|
||||
8192 64 8192
|
||||
Testing that * has precedence over >>
|
||||
select 3 * 4 >> 2, (3 * 4) >> 2, 3 * (4 >> 2);
|
||||
3 * 4 >> 2 (3 * 4) >> 2 3 * (4 >> 2)
|
||||
3 3 3
|
||||
select 4 >> 2 * 3, (4 >> 2) * 3, 4 >> (2 * 3);
|
||||
4 >> 2 * 3 (4 >> 2) * 3 4 >> (2 * 3)
|
||||
0 3 0
|
||||
Testing that * has precedence over binary +
|
||||
select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
|
||||
2 * 3 + 4 (2 * 3) + 4 2 * (3 + 4)
|
||||
10 10 14
|
||||
select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
|
||||
2 + 3 * 4 (2 + 3) * 4 2 + (3 * 4)
|
||||
14 20 14
|
||||
Testing that * has precedence over binary -
|
||||
select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
|
||||
4 * 3 - 2 (4 * 3) - 2 4 * (3 - 2)
|
||||
10 10 4
|
||||
select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
|
||||
4 - 3 * 2 (4 - 3) * 2 4 - (3 * 2)
|
||||
-2 2 -2
|
||||
Testing that / is left associative
|
||||
select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
|
||||
15 / 5 / 3 (15 / 5) / 3 15 / (5 / 3)
|
||||
1.00000000 1.00000000 9.0000
|
||||
Testing that / has precedence over |
|
||||
select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
|
||||
105 / 5 | 2 (105 / 5) | 2 105 / (5 | 2)
|
||||
23 23 15.0000
|
||||
select 105 | 2 / 5, (105 | 2) / 5, 105 | (2 / 5);
|
||||
105 | 2 / 5 (105 | 2) / 5 105 | (2 / 5)
|
||||
105 21.4000 105
|
||||
Testing that / has precedence over &
|
||||
select 105 / 5 & 0x0F, (105 / 5) & 0x0F, 105 / (5 & 0x0F);
|
||||
105 / 5 & 0x0F (105 / 5) & 0x0F 105 / (5 & 0x0F)
|
||||
5 5 21.0000
|
||||
select 0x0F & 105 / 5, (0x0F & 105) / 5, 0x0F & (105 / 5);
|
||||
0x0F & 105 / 5 (0x0F & 105) / 5 0x0F & (105 / 5)
|
||||
5 1.8000 5
|
||||
Testing that / has precedence over <<
|
||||
select 0x80 / 4 << 2, (0x80 / 4) << 2, 0x80 / (4 << 2);
|
||||
0x80 / 4 << 2 (0x80 / 4) << 2 0x80 / (4 << 2)
|
||||
128 128 8.0000
|
||||
select 0x80 << 4 / 2, (0x80 << 4) / 2, 0x80 << (4 / 2);
|
||||
0x80 << 4 / 2 (0x80 << 4) / 2 0x80 << (4 / 2)
|
||||
512 1024.0000 512
|
||||
Testing that / has precedence over >>
|
||||
select 0x80 / 4 >> 2, (0x80 / 4) >> 2, 0x80 / (4 >> 2);
|
||||
0x80 / 4 >> 2 (0x80 / 4) >> 2 0x80 / (4 >> 2)
|
||||
8 8 128.0000
|
||||
select 0x80 >> 4 / 2, (0x80 >> 4) / 2, 0x80 >> (4 / 2);
|
||||
0x80 >> 4 / 2 (0x80 >> 4) / 2 0x80 >> (4 / 2)
|
||||
32 4.0000 32
|
||||
Testing that / has precedence over binary +
|
||||
select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
|
||||
0x80 / 2 + 2 (0x80 / 2) + 2 0x80 / (2 + 2)
|
||||
66.0000 66.0000 32.0000
|
||||
select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
|
||||
0x80 + 2 / 2 (0x80 + 2) / 2 0x80 + (2 / 2)
|
||||
129.0000 65.0000 129.0000
|
||||
Testing that / has precedence over binary -
|
||||
select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
|
||||
0x80 / 4 - 2 (0x80 / 4) - 2 0x80 / (4 - 2)
|
||||
30.0000 30.0000 64.0000
|
||||
select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);
|
||||
0x80 - 4 / 2 (0x80 - 4) / 2 0x80 - (4 / 2)
|
||||
126.0000 62.0000 126.0000
|
||||
Testing that ^ is associative
|
||||
select 0xFF ^ 0xF0 ^ 0x0F, (0xFF ^ 0xF0) ^ 0x0F, 0xFF ^ (0xF0 ^ 0x0F);
|
||||
0xFF ^ 0xF0 ^ 0x0F (0xFF ^ 0xF0) ^ 0x0F 0xFF ^ (0xF0 ^ 0x0F)
|
||||
0 0 0
|
||||
select 0xFF ^ 0xF0 ^ 0x55, (0xFF ^ 0xF0) ^ 0x55, 0xFF ^ (0xF0 ^ 0x55);
|
||||
0xFF ^ 0xF0 ^ 0x55 (0xFF ^ 0xF0) ^ 0x55 0xFF ^ (0xF0 ^ 0x55)
|
||||
90 90 90
|
||||
Testing that ^ has precedence over |
|
||||
select 0xFF ^ 0xF0 | 0x0F, (0xFF ^ 0xF0) | 0x0F, 0xFF ^ (0xF0 | 0x0F);
|
||||
0xFF ^ 0xF0 | 0x0F (0xFF ^ 0xF0) | 0x0F 0xFF ^ (0xF0 | 0x0F)
|
||||
15 15 0
|
||||
select 0xF0 | 0xFF ^ 0xF0, (0xF0 | 0xFF) ^ 0xF0, 0xF0 | (0xFF ^ 0xF0);
|
||||
0xF0 | 0xFF ^ 0xF0 (0xF0 | 0xFF) ^ 0xF0 0xF0 | (0xFF ^ 0xF0)
|
||||
255 15 255
|
||||
Testing that ^ has precedence over &
|
||||
select 0xFF ^ 0xF0 & 0x0F, (0xFF ^ 0xF0) & 0x0F, 0xFF ^ (0xF0 & 0x0F);
|
||||
0xFF ^ 0xF0 & 0x0F (0xFF ^ 0xF0) & 0x0F 0xFF ^ (0xF0 & 0x0F)
|
||||
15 15 255
|
||||
select 0x0F & 0xFF ^ 0xF0, (0x0F & 0xFF) ^ 0xF0, 0x0F & (0xFF ^ 0xF0);
|
||||
0x0F & 0xFF ^ 0xF0 (0x0F & 0xFF) ^ 0xF0 0x0F & (0xFF ^ 0xF0)
|
||||
15 255 15
|
||||
Testing that ^ has precedence over <<
|
||||
select 0xFF ^ 0xF0 << 2, (0xFF ^ 0xF0) << 2, 0xFF ^ (0xF0 << 2);
|
||||
0xFF ^ 0xF0 << 2 (0xFF ^ 0xF0) << 2 0xFF ^ (0xF0 << 2)
|
||||
60 60 831
|
||||
select 0x0F << 2 ^ 0xFF, (0x0F << 2) ^ 0xFF, 0x0F << (2 ^ 0xFF);
|
||||
0x0F << 2 ^ 0xFF (0x0F << 2) ^ 0xFF 0x0F << (2 ^ 0xFF)
|
||||
0 195 0
|
||||
Testing that ^ has precedence over >>
|
||||
select 0xFF ^ 0xF0 >> 2, (0xFF ^ 0xF0) >> 2, 0xFF ^ (0xF0 >> 2);
|
||||
0xFF ^ 0xF0 >> 2 (0xFF ^ 0xF0) >> 2 0xFF ^ (0xF0 >> 2)
|
||||
3 3 195
|
||||
select 0xFF >> 2 ^ 0xF0, (0xFF >> 2) ^ 0xF0, 0xFF >> (2 ^ 0xF0);
|
||||
0xFF >> 2 ^ 0xF0 (0xFF >> 2) ^ 0xF0 0xFF >> (2 ^ 0xF0)
|
||||
0 207 0
|
||||
Testing that ^ has precedence over binary +
|
||||
select 0xFF ^ 0xF0 + 0x0F, (0xFF ^ 0xF0) + 0x0F, 0xFF ^ (0xF0 + 0x0F);
|
||||
0xFF ^ 0xF0 + 0x0F (0xFF ^ 0xF0) + 0x0F 0xFF ^ (0xF0 + 0x0F)
|
||||
30 30 0
|
||||
select 0x0F + 0xFF ^ 0xF0, (0x0F + 0xFF) ^ 0xF0, 0x0F + (0xFF ^ 0xF0);
|
||||
0x0F + 0xFF ^ 0xF0 (0x0F + 0xFF) ^ 0xF0 0x0F + (0xFF ^ 0xF0)
|
||||
30 510 30
|
||||
Testing that ^ has precedence over binary -
|
||||
select 0xFF ^ 0xF0 - 1, (0xFF ^ 0xF0) - 1, 0xFF ^ (0xF0 - 1);
|
||||
0xFF ^ 0xF0 - 1 (0xFF ^ 0xF0) - 1 0xFF ^ (0xF0 - 1)
|
||||
14 14 16
|
||||
select 0x55 - 0x0F ^ 0x55, (0x55 - 0x0F) ^ 0x55, 0x55 - (0x0F ^ 0x55);
|
||||
0x55 - 0x0F ^ 0x55 (0x55 - 0x0F) ^ 0x55 0x55 - (0x0F ^ 0x55)
|
||||
-5 19 -5
|
||||
Testing that ^ has precedence over *
|
||||
select 0xFF ^ 0xF0 * 2, (0xFF ^ 0xF0) * 2, 0xFF ^ (0xF0 * 2);
|
||||
0xFF ^ 0xF0 * 2 (0xFF ^ 0xF0) * 2 0xFF ^ (0xF0 * 2)
|
||||
30 30 287
|
||||
select 2 * 0xFF ^ 0xF0, (2 * 0xFF) ^ 0xF0, 2 * (0xFF ^ 0xF0);
|
||||
2 * 0xFF ^ 0xF0 (2 * 0xFF) ^ 0xF0 2 * (0xFF ^ 0xF0)
|
||||
30 270 30
|
||||
Testing that ^ has precedence over /
|
||||
select 0xFF ^ 0xF0 / 2, (0xFF ^ 0xF0) / 2, 0xFF ^ (0xF0 / 2);
|
||||
0xFF ^ 0xF0 / 2 (0xFF ^ 0xF0) / 2 0xFF ^ (0xF0 / 2)
|
||||
7.5000 7.5000 135
|
||||
select 0xF2 / 2 ^ 0xF0, (0xF2 / 2) ^ 0xF0, 0xF2 / (2 ^ 0xF0);
|
||||
0xF2 / 2 ^ 0xF0 (0xF2 / 2) ^ 0xF0 0xF2 / (2 ^ 0xF0)
|
||||
1.0000 137 1.0000
|
||||
Testing that ^ has precedence over %
|
||||
select 0xFF ^ 0xF0 % 0x20, (0xFF ^ 0xF0) % 0x20, 0xFF ^ (0xF0 % 0x20);
|
||||
0xFF ^ 0xF0 % 0x20 (0xFF ^ 0xF0) % 0x20 0xFF ^ (0xF0 % 0x20)
|
||||
15 15 239
|
||||
select 0xFF % 0x20 ^ 0xF0, (0xFF % 0x20) ^ 0xF0, 0xFF % (0x20 ^ 0xF0);
|
||||
0xFF % 0x20 ^ 0xF0 (0xFF % 0x20) ^ 0xF0 0xFF % (0x20 ^ 0xF0)
|
||||
47 239 47
|
||||
Testing that ^ has precedence over DIV
|
||||
select 0xFF ^ 0xF0 DIV 2, (0xFF ^ 0xF0) DIV 2, 0xFF ^ (0xF0 DIV 2);
|
||||
0xFF ^ 0xF0 DIV 2 (0xFF ^ 0xF0) DIV 2 0xFF ^ (0xF0 DIV 2)
|
||||
7 7 135
|
||||
select 0xF2 DIV 2 ^ 0xF0, (0xF2 DIV 2) ^ 0xF0, 0xF2 DIV (2 ^ 0xF0);
|
||||
0xF2 DIV 2 ^ 0xF0 (0xF2 DIV 2) ^ 0xF0 0xF2 DIV (2 ^ 0xF0)
|
||||
1 137 1
|
||||
Testing that ^ has precedence over MOD
|
||||
select 0xFF ^ 0xF0 MOD 0x20, (0xFF ^ 0xF0) MOD 0x20, 0xFF ^ (0xF0 MOD 0x20);
|
||||
0xFF ^ 0xF0 MOD 0x20 (0xFF ^ 0xF0) MOD 0x20 0xFF ^ (0xF0 MOD 0x20)
|
||||
15 15 239
|
||||
select 0xFF MOD 0x20 ^ 0xF0, (0xFF MOD 0x20) ^ 0xF0, 0xFF MOD (0x20 ^ 0xF0);
|
||||
0xFF MOD 0x20 ^ 0xF0 (0xFF MOD 0x20) ^ 0xF0 0xFF MOD (0x20 ^ 0xF0)
|
||||
47 239 47
|
@ -6315,4 +6315,78 @@ CALL p1();
|
||||
NULL
|
||||
SET NAMES default;
|
||||
DROP PROCEDURE p1;
|
||||
create function f1()
|
||||
returns int(11)
|
||||
not deterministic
|
||||
contains sql
|
||||
sql security definer
|
||||
comment ''
|
||||
begin
|
||||
declare x int(11);
|
||||
set x=-1;
|
||||
return x;
|
||||
end|
|
||||
create view v1 as select 1 as one, f1() as days;
|
||||
show create view test.v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select 1 AS `one`,`f1`() AS `days`
|
||||
select column_name from information_schema.columns
|
||||
where table_name='v1' and table_schema='test';
|
||||
column_name
|
||||
one
|
||||
days
|
||||
drop view v1;
|
||||
drop function f1;
|
||||
|
||||
# Bug#13675.
|
||||
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
CREATE PROCEDURE p1(v DATETIME) CREATE TABLE t1 SELECT v;
|
||||
CREATE PROCEDURE p2(v INT) CREATE TABLE t1 SELECT v;
|
||||
|
||||
CALL p1(NOW());
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`v` datetime default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
CALL p1('text');
|
||||
Warnings:
|
||||
Warning 1264 Out of range value adjusted for column 'v' at row 1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`v` datetime default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
CALL p2(10);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`v` bigint(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
CALL p2('text');
|
||||
Warnings:
|
||||
Warning 1366 Incorrect integer value: 'text' for column 'v' at row 1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`v` bigint(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
End of 5.0 tests
|
||||
|
@ -43,3 +43,51 @@ SHOW STATUS LIKE 'max_used_connections';
|
||||
Variable_name Value
|
||||
Max_used_connections 4
|
||||
SET GLOBAL thread_cache_size=@save_thread_cache_size;
|
||||
CREATE TABLE t1 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
SELECT a FROM t1 LIMIT 1;
|
||||
a
|
||||
1
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 2.402418
|
||||
EXPLAIN SELECT a FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 2.402418
|
||||
SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
2
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 0.000000
|
||||
EXPLAIN SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
2 UNION t1 ALL NULL NULL NULL NULL 2
|
||||
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 0.000000
|
||||
SELECT a IN (SELECT a FROM t1) FROM t1 LIMIT 1;
|
||||
a IN (SELECT a FROM t1)
|
||||
1
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 0.000000
|
||||
SELECT (SELECT a FROM t1 LIMIT 1) x FROM t1 LIMIT 1;
|
||||
x
|
||||
1
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 0.000000
|
||||
SELECT * FROM t1 a, t1 b LIMIT 1;
|
||||
a a
|
||||
1 1
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 4.805836
|
||||
DROP TABLE t1;
|
||||
|
@ -642,4 +642,19 @@ b+0 COUNT(DISTINCT a)
|
||||
1 1
|
||||
3 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (b BIT);
|
||||
INSERT INTO t1 (b) VALUES (1), (0);
|
||||
SELECT DISTINCT b FROM t1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 t1 b b 16 1 1 Y 32 0 63
|
||||
b
|
||||
#
|
||||
#
|
||||
SELECT b FROM t1 GROUP BY b;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 t1 b b 16 1 1 Y 32 0 63
|
||||
b
|
||||
#
|
||||
#
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1-0.1.Data
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1-0.1.Data
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1-0.2.Data
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1-0.2.Data
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.1.ctl
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.1.ctl
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.1.log
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.1.log
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.2.ctl
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.2.ctl
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.2.log
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.2.log
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1-0.1.Data
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1-0.1.Data
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1-0.2.Data
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1-0.2.Data
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.1.ctl
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.1.ctl
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.1.log
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.1.log
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.2.ctl
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.2.ctl
Normal file
Binary file not shown.
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.2.log
Normal file
BIN
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.2.log
Normal file
Binary file not shown.
@ -19,3 +19,36 @@ select 1 # The rest of the row will be ignored
|
||||
/* line with only comment */;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
|
||||
#
|
||||
# Bug#28779 (mysql_query() allows execution of statements with unbalanced
|
||||
# comments)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists table_28779;
|
||||
--enable_warnings
|
||||
|
||||
create table table_28779 (a int);
|
||||
|
||||
--error 1064
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';";
|
||||
|
||||
--error 1064
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';*";
|
||||
|
||||
--error 1064
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;";
|
||||
|
||||
--error 1064
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;*";
|
||||
|
||||
--error 1064
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';";
|
||||
|
||||
--error 1064
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';*";
|
||||
|
||||
drop table table_28779;
|
||||
|
||||
|
@ -173,8 +173,20 @@ delete from t1 where (@a:= f1) order by f1 limit 1;
|
||||
select @a;
|
||||
drop table t1;
|
||||
|
||||
# BUG#30385 "Server crash when deleting with order by and limit"
|
||||
CREATE TABLE t1 (
|
||||
`date` date ,
|
||||
`time` time ,
|
||||
`seq` int(10) unsigned NOT NULL auto_increment,
|
||||
PRIMARY KEY (`seq`),
|
||||
KEY `seq` (`seq`),
|
||||
KEY `time` (`time`),
|
||||
KEY `date` (`date`)
|
||||
);
|
||||
DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Test of multi-delete where we are not scanning the first table
|
||||
@ -221,3 +233,47 @@ DELETE FROM t1 ORDER BY t2.x;
|
||||
DELETE FROM t1 ORDER BY (SELECT x);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #30234: Unexpected behavior using DELETE with AS and USING
|
||||
# '
|
||||
CREATE TABLE t1 (
|
||||
a INT
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a INT
|
||||
);
|
||||
|
||||
CREATE DATABASE db1;
|
||||
CREATE TABLE db1.t1 (
|
||||
a INT
|
||||
);
|
||||
INSERT INTO db1.t1 (a) SELECT * FROM t1;
|
||||
|
||||
CREATE DATABASE db2;
|
||||
CREATE TABLE db2.t1 (
|
||||
a INT
|
||||
);
|
||||
INSERT INTO db2.t1 (a) SELECT * FROM t2;
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
DELETE FROM t1 alias USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
DELETE FROM alias USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
DELETE FROM t1, alias USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE FROM t1, t2 USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
--error ER_PARSE_ERROR
|
||||
DELETE FROM db1.t1 alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE FROM alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
DELETE FROM db2.alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
DELETE FROM t1 USING t1 WHERE a = 1;
|
||||
SELECT * FROM t1;
|
||||
--error ER_PARSE_ERROR
|
||||
DELETE FROM t1 alias USING t1 alias WHERE a = 2;
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
|
@ -788,3 +788,30 @@ select * from t1 group by f1, f2;
|
||||
select t1.f1,t.* from t1, t1 t group by 1;
|
||||
drop table t1;
|
||||
SET SQL_MODE = '';
|
||||
|
||||
#
|
||||
# Bug#30596: GROUP BY optimization gives wrong result order
|
||||
#
|
||||
CREATE TABLE t1(
|
||||
a INT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL,
|
||||
d INT,
|
||||
UNIQUE KEY (c,b)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
|
||||
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d;
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b,d;
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
|
||||
EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d;
|
||||
SELECT c,b,d FROM t1 ORDER BY c,b,d;
|
||||
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b;
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b;
|
||||
EXPLAIN SELECT c,b FROM t1 GROUP BY c,b;
|
||||
SELECT c,b FROM t1 GROUP BY c,b;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -441,3 +441,22 @@ handler t1 open;
|
||||
--echo --> client 1
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#30632 HANDLER read failure causes hang
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
handler t1 open as t1_alias;
|
||||
--error 1176
|
||||
handler t1_alias read a next;
|
||||
--error 1054
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
--error 1176
|
||||
handler t1_alias read a next;
|
||||
--error 1054
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
handler t1_alias close;
|
||||
drop table t1;
|
||||
|
@ -112,4 +112,29 @@ commit;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#25164 create table `a` as select * from `A` hangs
|
||||
#
|
||||
|
||||
set storage_engine=innodb;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists a;
|
||||
drop table if exists A;
|
||||
--enable_warnings
|
||||
|
||||
create table A (c int);
|
||||
insert into A (c) values (0);
|
||||
--error 0,ER_LOCK_DEADLOCK,ER_UPDATE_TABLE_USED
|
||||
create table a as select * from A;
|
||||
drop table A;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists a;
|
||||
--enable_warnings
|
||||
|
||||
set storage_engine=default;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@ -910,4 +910,31 @@ ROLLBACK;
|
||||
ROLLBACK;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#30596: GROUP BY optimization gives wrong result order
|
||||
#
|
||||
CREATE TABLE t1(
|
||||
a INT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL,
|
||||
d INT,
|
||||
UNIQUE KEY (c,b)
|
||||
) engine=innodb;
|
||||
|
||||
INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
|
||||
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d;
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b,d;
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
|
||||
EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d;
|
||||
SELECT c,b,d FROM t1 ORDER BY c,b,d;
|
||||
|
||||
EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b;
|
||||
SELECT c,b,d FROM t1 GROUP BY c,b;
|
||||
EXPLAIN SELECT c,b FROM t1 GROUP BY c,b;
|
||||
SELECT c,b FROM t1 GROUP BY c,b;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -276,4 +276,9 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
|
||||
--exec $MYSQL --pager="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" > /dev/null 2>&1
|
||||
--exec $MYSQL --character-sets-dir="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" 2>&1
|
||||
|
||||
#
|
||||
# bug #30164: Using client side macro inside server side comments generates broken queries
|
||||
#
|
||||
--exec $MYSQL test -e "/*! \C latin1 */ select 1;"
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
1
mysql-test/t/mysqldump-compat.opt
Normal file
1
mysql-test/t/mysqldump-compat.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-debug=d,4x_server_emul
|
13
mysql-test/t/mysqldump-compat.test
Normal file
13
mysql-test/t/mysqldump-compat.test
Normal file
@ -0,0 +1,13 @@
|
||||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Bug #30126: semicolon before closing */ in /*!... CREATE DATABASE ;*/
|
||||
#
|
||||
|
||||
CREATE DATABASE mysqldump_30126;
|
||||
USE mysqldump_30126;
|
||||
CREATE TABLE t1 (c1 int);
|
||||
--exec $MYSQL_DUMP --add-drop-database mysqldump_30126 > $MYSQLTEST_VARDIR/tmp/bug30126.sql
|
||||
--exec $MYSQL mysqldump_30126 < $MYSQLTEST_VARDIR/tmp/bug30126.sql
|
||||
DROP DATABASE mysqldump_30126;
|
35
mysql-test/t/ndb_bug26793.test
Normal file
35
mysql-test/t/ndb_bug26793.test
Normal file
@ -0,0 +1,35 @@
|
||||
-- source include/have_ndb.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE `test` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
`t` VARCHAR( 10 ) NOT NULL
|
||||
) ENGINE = ndbcluster;
|
||||
|
||||
# Add user1@localhost with a specific password
|
||||
# and connect as that user
|
||||
GRANT USAGE ON *.* TO user1@localhost IDENTIFIED BY 'pass';
|
||||
connect (user1,localhost,user1,pass,*NO-ONE*);
|
||||
|
||||
# Run the query 100 times
|
||||
disable_query_log;
|
||||
disable_result_log;
|
||||
let $i= 100;
|
||||
while ($i)
|
||||
{
|
||||
select count(*) from information_schema.tables union all select count(*) from information_schema.tables union all select count(*) from information_schema.tables;
|
||||
dec $i;
|
||||
}
|
||||
enable_query_log;
|
||||
enable_result_log;
|
||||
|
||||
disconnect user1;
|
||||
|
||||
# Switch back to the default connection and cleanup
|
||||
connection default;
|
||||
DROP TABLE `test`.`test`;
|
||||
drop user user1@localhost;
|
||||
|
@ -291,3 +291,25 @@ insert into t2 values (1,1), (10,10);
|
||||
select * from t2 use index (ab) where a in(1,10) order by a;
|
||||
|
||||
drop table t2;
|
||||
|
||||
#bug#30337
|
||||
|
||||
create table t1 (id int primary key) engine ndb;
|
||||
insert into t1 values (1), (2), (3);
|
||||
|
||||
create table t2 (id int primary key) engine ndb;
|
||||
insert into t2 select id from t1;
|
||||
|
||||
delimiter |;
|
||||
create trigger kaboom after delete on t1
|
||||
for each row begin
|
||||
delete from t2 where id=old.id;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
select * from t1 order by id;
|
||||
delete from t1 where id in (1,2);
|
||||
select * from t2 order by id;
|
||||
|
||||
drop trigger kaboom;
|
||||
drop table t1;
|
||||
|
185
mysql-test/t/ndb_restore_different_endian_data.test
Normal file
185
mysql-test/t/ndb_restore_different_endian_data.test
Normal file
@ -0,0 +1,185 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Bug #27543 restore of backup from different endian does not work for blob column
|
||||
# Bug #30024 restore of backup from different endian does not work for datetime column
|
||||
# Bug #28674 backup will run forever if disk full and later write succes will kill ndb node
|
||||
#
|
||||
# The table structure and data list below
|
||||
#
|
||||
# CREATE TABLE t_num (
|
||||
# t_pk INT PRIMARY KEY,
|
||||
# t_bit BIT(64),
|
||||
# t_tinyint TINYINT,
|
||||
# t_bool BOOL,
|
||||
# t_smallint SMALLINT,
|
||||
# t_mediumint MEDIUMINT,
|
||||
# t_int INT,
|
||||
# t_bigint BIGINT,
|
||||
# t_float FLOAT,
|
||||
# t_double DOUBLE,
|
||||
# t_decimal DECIMAL (37, 16)
|
||||
# ) ENGINE=NDBCLUSTER;
|
||||
#
|
||||
# INSERT INTO t_num VALUE (
|
||||
# 1,
|
||||
# b'1010101010101010101010101010101010101010101010101010101010101010',
|
||||
# 125,
|
||||
# 1,
|
||||
# 32765,
|
||||
# 8388606,
|
||||
# 2147483647,
|
||||
# 9223372036854775807,
|
||||
# 1e+20,
|
||||
# 1e+150,
|
||||
# '331.0000000000'
|
||||
# );
|
||||
#
|
||||
# CREATE TABLE t_datetime (
|
||||
# t_pk INT PRIMARY KEY,
|
||||
# t_date DATE,
|
||||
# t_datetime DATETIME,
|
||||
# t_timestamp TIMESTAMP,
|
||||
# t_time TIME,
|
||||
# t_year YEAR
|
||||
# ) ENGINE=NDBCLUSTER;
|
||||
#
|
||||
# INSERT INTO t_datetime VALUE (
|
||||
# 1,
|
||||
# '1998-01-01',
|
||||
# '2006-08-10 10:11:12',
|
||||
# 20021029165106,
|
||||
# '19:38:34',
|
||||
# 2155
|
||||
# );
|
||||
#
|
||||
# CREATE TABLE t_string_1 (
|
||||
# t_pk INT PRIMARY KEY,
|
||||
# t_char CHAR(255),
|
||||
# t_varchar VARCHAR(655),
|
||||
# t_binary BINARY(255),
|
||||
# t_varbinary VARBINARY(6553)
|
||||
# ) ENGINE=NDBCLUSTER;
|
||||
#
|
||||
# CREATE TABLE t_string_2 (
|
||||
# t_pk INT PRIMARY KEY,
|
||||
# t_tinyblob TINYBLOB,
|
||||
# t_tinytext TINYTEXT,
|
||||
# t_blob BLOB,
|
||||
# t_text TEXT,
|
||||
# t_mediumblob MEDIUMBLOB,
|
||||
# t_mediumtext MEDIUMTEXT,
|
||||
# t_longblob LONGBLOB,
|
||||
# t_longtext LONGTEXT,
|
||||
# t_enum ENUM('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007')DEFAULT '001001' NOT NULL,
|
||||
# t_set SET('a','B')
|
||||
# ) ENGINE=NDBCLUSTER;
|
||||
#
|
||||
# INSERT INTO t_string_1 VALUE (
|
||||
# 1,
|
||||
# 'abcdefghijklmn',
|
||||
# 'abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn',
|
||||
# 0x612020,
|
||||
# 0x4100
|
||||
# );
|
||||
#
|
||||
# INSERT INTO t_string_2 VALUE (
|
||||
# 1,
|
||||
# 'abcdefghijklmnabcdefghijklmn',
|
||||
# 'abcdefghijklmnabcdefghijklmn',
|
||||
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
|
||||
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
|
||||
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
|
||||
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
|
||||
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
|
||||
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789',
|
||||
# '001001',
|
||||
# 'a'
|
||||
# );
|
||||
#
|
||||
# CREATE TABLE t_gis (
|
||||
# t_pk INT PRIMARY KEY,
|
||||
# t_point POINT,
|
||||
# t_linestring LINESTRING,
|
||||
# t_polygon POLYGON,
|
||||
# t_multipoint MULTIPOINT,
|
||||
# t_multilinestring MULTILINESTRING,
|
||||
# t_multipolygon MULTIPOLYGON,
|
||||
# t_geometrycollection GEOMETRYCOLLECTION,
|
||||
# t_geometry GEOMETRY
|
||||
# ) ENGINE=NDBCLUSTER;
|
||||
#
|
||||
# INSERT INTO t_gis VALUE (
|
||||
# 1,
|
||||
# PointFromText('POINT(10 10)'),
|
||||
# LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)'),
|
||||
# PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'),
|
||||
# MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)'),
|
||||
# MLineFromText('MULTILINESTRING((10 48,10 21,10 0))'),
|
||||
# MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),
|
||||
# GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'),
|
||||
# MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')
|
||||
# );
|
||||
#
|
||||
# INSERT INTO t_gis VALUE (
|
||||
# 2,
|
||||
# PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))),
|
||||
# LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))),
|
||||
# PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))),
|
||||
# MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))),
|
||||
# MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))),
|
||||
# MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))),
|
||||
# GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))),
|
||||
# GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))
|
||||
# );
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Restore backup files (from little endian)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS t_num,t_datetime,t_string_1,t_string_2,t_gis;
|
||||
--enable_warnings
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r $MYSQL_TEST_DIR/std_data/ndb_backup50_data_le >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r $MYSQL_TEST_DIR/std_data/ndb_backup50_data_le >> $NDB_TOOLS_OUTPUT
|
||||
SHOW TABLES;
|
||||
SHOW CREATE TABLE t_num;
|
||||
SHOW CREATE TABLE t_datetime;
|
||||
SHOW CREATE TABLE t_string_1;
|
||||
SHOW CREATE TABLE t_string_2;
|
||||
SHOW CREATE TABLE t_gis;
|
||||
SELECT * FROM t_datetime;
|
||||
SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num;
|
||||
SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1;
|
||||
SELECT * FROM t_string_2;
|
||||
SELECT AsText(t_point), AsText(t_linestring),AsText(t_polygon) FROM t_gis ORDER by t_pk;
|
||||
SELECT AsText(t_multipoint), AsText(t_multilinestring),AsText(t_multipolygon) FROM t_gis ORDER by t_pk;
|
||||
SELECT AsText(t_geometrycollection), AsText(t_geometry) FROM t_gis ORDER by t_pk;
|
||||
|
||||
#
|
||||
# Restore backup files (from big endian)
|
||||
#
|
||||
|
||||
DROP TABLE t_num,t_datetime,t_string_1,t_string_2,t_gis;
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r $MYSQL_TEST_DIR/std_data/ndb_backup50_data_be >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r $MYSQL_TEST_DIR/std_data/ndb_backup50_data_be >> $NDB_TOOLS_OUTPUT
|
||||
SHOW TABLES;
|
||||
SHOW CREATE TABLE t_num;
|
||||
SHOW CREATE TABLE t_datetime;
|
||||
SHOW CREATE TABLE t_string_1;
|
||||
SHOW CREATE TABLE t_string_2;
|
||||
SHOW CREATE TABLE t_gis;
|
||||
SELECT * FROM t_datetime;
|
||||
SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num;
|
||||
SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1;
|
||||
SELECT * FROM t_string_2;
|
||||
SELECT AsText(t_point), AsText(t_linestring),AsText(t_polygon) FROM t_gis ORDER by t_pk;
|
||||
SELECT AsText(t_multipoint), AsText(t_multilinestring),AsText(t_multipolygon) FROM t_gis ORDER by t_pk;
|
||||
SELECT AsText(t_geometrycollection), AsText(t_geometry) FROM t_gis ORDER by t_pk;
|
||||
|
||||
DROP TABLE t_num,t_datetime,t_string_1,t_string_2,t_gis;
|
333
mysql-test/t/parser_precedence.test
Normal file
333
mysql-test/t/parser_precedence.test
Normal file
@ -0,0 +1,333 @@
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1_30237_bool;
|
||||
--enable_warnings
|
||||
|
||||
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
||||
|
||||
insert into t1_30237_bool values
|
||||
(FALSE, FALSE, FALSE),
|
||||
(FALSE, FALSE, NULL),
|
||||
(FALSE, FALSE, TRUE),
|
||||
(FALSE, NULL, FALSE),
|
||||
(FALSE, NULL, NULL),
|
||||
(FALSE, NULL, TRUE),
|
||||
(FALSE, TRUE, FALSE),
|
||||
(FALSE, TRUE, NULL),
|
||||
(FALSE, TRUE, TRUE),
|
||||
(NULL, FALSE, FALSE),
|
||||
(NULL, FALSE, NULL),
|
||||
(NULL, FALSE, TRUE),
|
||||
(NULL, NULL, FALSE),
|
||||
(NULL, NULL, NULL),
|
||||
(NULL, NULL, TRUE),
|
||||
(NULL, TRUE, FALSE),
|
||||
(NULL, TRUE, NULL),
|
||||
(NULL, TRUE, TRUE),
|
||||
(TRUE, FALSE, FALSE),
|
||||
(TRUE, FALSE, NULL),
|
||||
(TRUE, FALSE, TRUE),
|
||||
(TRUE, NULL, FALSE),
|
||||
(TRUE, NULL, NULL),
|
||||
(TRUE, NULL, TRUE),
|
||||
(TRUE, TRUE, FALSE),
|
||||
(TRUE, TRUE, NULL),
|
||||
(TRUE, TRUE, TRUE) ;
|
||||
|
||||
--echo Testing OR, XOR, AND
|
||||
select A, B, A OR B, A XOR B, A AND B
|
||||
from t1_30237_bool where C is null order by A, B;
|
||||
|
||||
--echo Testing that OR is associative
|
||||
select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A OR B) OR C) != (A OR (B OR C));
|
||||
|
||||
--echo Testing that XOR is associative
|
||||
select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) XOR C) != (A XOR (B XOR C));
|
||||
|
||||
--echo Testing that AND is associative
|
||||
select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) AND C) != (A AND (B AND C));
|
||||
|
||||
--echo Testing that AND has precedence over OR
|
||||
select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B AND C)) != (A OR B AND C);
|
||||
select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) OR C) != (A AND B OR C);
|
||||
|
||||
--echo Testing that AND has precedence over XOR
|
||||
select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where (A XOR (B AND C)) != (A XOR B AND C);
|
||||
select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) XOR C) != (A AND B XOR C);
|
||||
|
||||
--echo Testing that XOR has precedence over OR
|
||||
select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) OR C) != (A XOR B OR C);
|
||||
select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B XOR C)) != (A OR B XOR C);
|
||||
|
||||
drop table t1_30237_bool;
|
||||
|
||||
--echo Testing that NOT has precedence over OR
|
||||
select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
|
||||
|
||||
--echo Testing that NOT has precedence over XOR
|
||||
select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
|
||||
|
||||
--echo Testing that NOT has precedence over AND
|
||||
select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
|
||||
|
||||
--echo Testing that NOT is associative
|
||||
select NOT NOT TRUE, NOT NOT NOT FALSE;
|
||||
|
||||
--echo Testing that IS has precedence over NOT
|
||||
select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
|
||||
select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
|
||||
select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
|
||||
select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
|
||||
select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
|
||||
select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
|
||||
select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
|
||||
select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
|
||||
|
||||
--echo Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
|
||||
# Documenting existing behavior in 5.0.48
|
||||
-- error ER_PARSE_ERROR
|
||||
select TRUE IS TRUE IS TRUE IS TRUE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select NULL IS FALSE IS FALSE IS FALSE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
|
||||
-- error ER_PARSE_ERROR
|
||||
select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
|
||||
|
||||
--echo Testing that IS [NOT] NULL predicates are associative
|
||||
# Documenting existing behavior in 5.0.48
|
||||
select FALSE IS NULL IS NULL IS NULL;
|
||||
select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
|
||||
|
||||
--echo Testing that comparison operators are left associative
|
||||
select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
|
||||
select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
|
||||
select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
|
||||
select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
|
||||
select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
|
||||
select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
|
||||
select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
|
||||
select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
|
||||
|
||||
-- echo Testing that | is associative
|
||||
select 0xF0 | 0x0F | 0x55, (0xF0 | 0x0F) | 0x55, 0xF0 | (0x0F | 0x55);
|
||||
|
||||
-- echo Testing that & is associative
|
||||
select 0xF5 & 0x5F & 0x55, (0xF5 & 0x5F) & 0x55, 0xF5 & (0x5F & 0x55);
|
||||
|
||||
-- echo Testing that << is left associative
|
||||
select 4 << 3 << 2, (4 << 3) << 2, 4 << (3 << 2);
|
||||
|
||||
-- echo Testing that >> is left associative
|
||||
select 256 >> 3 >> 2, (256 >> 3) >> 2, 256 >> (3 >> 2);
|
||||
|
||||
--echo Testing that & has precedence over |
|
||||
select 0xF0 & 0x0F | 0x55, (0xF0 & 0x0F) | 0x55, 0xF0 & (0x0F | 0x55);
|
||||
select 0x55 | 0xF0 & 0x0F, (0x55 | 0xF0) & 0x0F, 0x55 | (0xF0 & 0x0F);
|
||||
|
||||
--echo Testing that << has precedence over |
|
||||
select 0x0F << 4 | 0x0F, (0x0F << 4) | 0x0F, 0x0F << (4 | 0x0F);
|
||||
select 0x0F | 0x0F << 4, (0x0F | 0x0F) << 4, 0x0F | (0x0F << 4);
|
||||
|
||||
--echo Testing that >> has precedence over |
|
||||
select 0xF0 >> 4 | 0xFF, (0xF0 >> 4) | 0xFF, 0xF0 >> (4 | 0xFF);
|
||||
select 0xFF | 0xF0 >> 4, (0xFF | 0xF0) >> 4, 0xFF | (0xF0 >> 4);
|
||||
|
||||
--echo Testing that << has precedence over &
|
||||
select 0x0F << 4 & 0xF0, (0x0F << 4) & 0xF0, 0x0F << (4 & 0xF0);
|
||||
select 0xF0 & 0x0F << 4, (0xF0 & 0x0F) << 4, 0xF0 & (0x0F << 4);
|
||||
|
||||
--echo Testing that >> has precedence over &
|
||||
select 0xF0 >> 4 & 0x55, (0xF0 >> 4) & 0x55, 0xF0 >> (4 & 0x55);
|
||||
select 0x0F & 0xF0 >> 4, (0x0F & 0xF0) >> 4, 0x0F & (0xF0 >> 4);
|
||||
|
||||
--echo Testing that >> and << have the same precedence
|
||||
select 0xFF >> 4 << 2, (0xFF >> 4) << 2, 0xFF >> (4 << 2);
|
||||
select 0x0F << 4 >> 2, (0x0F << 4) >> 2, 0x0F << (4 >> 2);
|
||||
|
||||
--echo Testing that binary + is associative
|
||||
select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
|
||||
|
||||
--echo Testing that binary - is left associative
|
||||
select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
|
||||
|
||||
--echo Testing that binary + and binary - have the same precedence
|
||||
# evaluated left to right
|
||||
select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
|
||||
select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
|
||||
|
||||
--echo Testing that binary + has precedence over |
|
||||
select 0xF0 + 0x0F | 0x55, (0xF0 + 0x0F) | 0x55, 0xF0 + (0x0F | 0x55);
|
||||
select 0x55 | 0xF0 + 0x0F, (0x55 | 0xF0) + 0x0F, 0x55 | (0xF0 + 0x0F);
|
||||
|
||||
--echo Testing that binary + has precedence over &
|
||||
select 0xF0 + 0x0F & 0x55, (0xF0 + 0x0F) & 0x55, 0xF0 + (0x0F & 0x55);
|
||||
select 0x55 & 0xF0 + 0x0F, (0x55 & 0xF0) + 0x0F, 0x55 & (0xF0 + 0x0F);
|
||||
|
||||
--echo Testing that binary + has precedence over <<
|
||||
select 2 + 3 << 4, (2 + 3) << 4, 2 + (3 << 4);
|
||||
select 3 << 4 + 2, (3 << 4) + 2, 3 << (4 + 2);
|
||||
|
||||
--echo Testing that binary + has precedence over >>
|
||||
select 4 + 3 >> 2, (4 + 3) >> 2, 4 + (3 >> 2);
|
||||
select 3 >> 2 + 1, (3 >> 2) + 1, 3 >> (2 + 1);
|
||||
|
||||
--echo Testing that binary - has precedence over |
|
||||
select 0xFF - 0x0F | 0x55, (0xFF - 0x0F) | 0x55, 0xFF - (0x0F | 0x55);
|
||||
select 0x55 | 0xFF - 0xF0, (0x55 | 0xFF) - 0xF0, 0x55 | (0xFF - 0xF0);
|
||||
|
||||
--echo Testing that binary - has precedence over &
|
||||
select 0xFF - 0xF0 & 0x55, (0xFF - 0xF0) & 0x55, 0xFF - (0xF0 & 0x55);
|
||||
select 0x55 & 0xFF - 0xF0, (0x55 & 0xFF) - 0xF0, 0x55 & (0xFF - 0xF0);
|
||||
|
||||
--echo Testing that binary - has precedence over <<
|
||||
select 16 - 3 << 2, (16 - 3) << 2, 16 - (3 << 2);
|
||||
select 4 << 3 - 2, (4 << 3) - 2, 4 << (3 - 2);
|
||||
|
||||
--echo Testing that binary - has precedence over >>
|
||||
select 16 - 3 >> 2, (16 - 3) >> 2, 16 - (3 >> 2);
|
||||
select 16 >> 3 - 2, (16 >> 3) - 2, 16 >> (3 - 2);
|
||||
|
||||
--echo Testing that * is associative
|
||||
select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
|
||||
|
||||
--echo Testing that * has precedence over |
|
||||
select 2 * 0x40 | 0x0F, (2 * 0x40) | 0x0F, 2 * (0x40 | 0x0F);
|
||||
select 0x0F | 2 * 0x40, (0x0F | 2) * 0x40, 0x0F | (2 * 0x40);
|
||||
|
||||
--echo Testing that * has precedence over &
|
||||
select 2 * 0x40 & 0x55, (2 * 0x40) & 0x55, 2 * (0x40 & 0x55);
|
||||
select 0xF0 & 2 * 0x40, (0xF0 & 2) * 0x40, 0xF0 & (2 * 0x40);
|
||||
|
||||
--echo Testing that * has precedence over <<
|
||||
# Actually, can't prove it for the first case,
|
||||
# since << is a multiplication by a power of 2,
|
||||
# and * is associative
|
||||
select 5 * 3 << 4, (5 * 3) << 4, 5 * (3 << 4);
|
||||
select 2 << 3 * 4, (2 << 3) * 4, 2 << (3 * 4);
|
||||
|
||||
--echo Testing that * has precedence over >>
|
||||
# >> is a multiplication by a (negative) power of 2,
|
||||
# see above.
|
||||
select 3 * 4 >> 2, (3 * 4) >> 2, 3 * (4 >> 2);
|
||||
select 4 >> 2 * 3, (4 >> 2) * 3, 4 >> (2 * 3);
|
||||
|
||||
--echo Testing that * has precedence over binary +
|
||||
select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
|
||||
select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
|
||||
|
||||
--echo Testing that * has precedence over binary -
|
||||
select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
|
||||
select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
|
||||
|
||||
--echo Testing that / is left associative
|
||||
select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
|
||||
|
||||
--echo Testing that / has precedence over |
|
||||
select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
|
||||
select 105 | 2 / 5, (105 | 2) / 5, 105 | (2 / 5);
|
||||
|
||||
--echo Testing that / has precedence over &
|
||||
select 105 / 5 & 0x0F, (105 / 5) & 0x0F, 105 / (5 & 0x0F);
|
||||
select 0x0F & 105 / 5, (0x0F & 105) / 5, 0x0F & (105 / 5);
|
||||
|
||||
--echo Testing that / has precedence over <<
|
||||
select 0x80 / 4 << 2, (0x80 / 4) << 2, 0x80 / (4 << 2);
|
||||
select 0x80 << 4 / 2, (0x80 << 4) / 2, 0x80 << (4 / 2);
|
||||
|
||||
--echo Testing that / has precedence over >>
|
||||
select 0x80 / 4 >> 2, (0x80 / 4) >> 2, 0x80 / (4 >> 2);
|
||||
select 0x80 >> 4 / 2, (0x80 >> 4) / 2, 0x80 >> (4 / 2);
|
||||
|
||||
--echo Testing that / has precedence over binary +
|
||||
select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
|
||||
select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
|
||||
|
||||
--echo Testing that / has precedence over binary -
|
||||
select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
|
||||
select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);
|
||||
|
||||
# TODO: %, DIV, MOD
|
||||
|
||||
--echo Testing that ^ is associative
|
||||
select 0xFF ^ 0xF0 ^ 0x0F, (0xFF ^ 0xF0) ^ 0x0F, 0xFF ^ (0xF0 ^ 0x0F);
|
||||
select 0xFF ^ 0xF0 ^ 0x55, (0xFF ^ 0xF0) ^ 0x55, 0xFF ^ (0xF0 ^ 0x55);
|
||||
|
||||
--echo Testing that ^ has precedence over |
|
||||
select 0xFF ^ 0xF0 | 0x0F, (0xFF ^ 0xF0) | 0x0F, 0xFF ^ (0xF0 | 0x0F);
|
||||
select 0xF0 | 0xFF ^ 0xF0, (0xF0 | 0xFF) ^ 0xF0, 0xF0 | (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over &
|
||||
select 0xFF ^ 0xF0 & 0x0F, (0xFF ^ 0xF0) & 0x0F, 0xFF ^ (0xF0 & 0x0F);
|
||||
select 0x0F & 0xFF ^ 0xF0, (0x0F & 0xFF) ^ 0xF0, 0x0F & (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over <<
|
||||
select 0xFF ^ 0xF0 << 2, (0xFF ^ 0xF0) << 2, 0xFF ^ (0xF0 << 2);
|
||||
select 0x0F << 2 ^ 0xFF, (0x0F << 2) ^ 0xFF, 0x0F << (2 ^ 0xFF);
|
||||
|
||||
--echo Testing that ^ has precedence over >>
|
||||
select 0xFF ^ 0xF0 >> 2, (0xFF ^ 0xF0) >> 2, 0xFF ^ (0xF0 >> 2);
|
||||
select 0xFF >> 2 ^ 0xF0, (0xFF >> 2) ^ 0xF0, 0xFF >> (2 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over binary +
|
||||
select 0xFF ^ 0xF0 + 0x0F, (0xFF ^ 0xF0) + 0x0F, 0xFF ^ (0xF0 + 0x0F);
|
||||
select 0x0F + 0xFF ^ 0xF0, (0x0F + 0xFF) ^ 0xF0, 0x0F + (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over binary -
|
||||
select 0xFF ^ 0xF0 - 1, (0xFF ^ 0xF0) - 1, 0xFF ^ (0xF0 - 1);
|
||||
select 0x55 - 0x0F ^ 0x55, (0x55 - 0x0F) ^ 0x55, 0x55 - (0x0F ^ 0x55);
|
||||
|
||||
--echo Testing that ^ has precedence over *
|
||||
select 0xFF ^ 0xF0 * 2, (0xFF ^ 0xF0) * 2, 0xFF ^ (0xF0 * 2);
|
||||
select 2 * 0xFF ^ 0xF0, (2 * 0xFF) ^ 0xF0, 2 * (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over /
|
||||
select 0xFF ^ 0xF0 / 2, (0xFF ^ 0xF0) / 2, 0xFF ^ (0xF0 / 2);
|
||||
select 0xF2 / 2 ^ 0xF0, (0xF2 / 2) ^ 0xF0, 0xF2 / (2 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over %
|
||||
select 0xFF ^ 0xF0 % 0x20, (0xFF ^ 0xF0) % 0x20, 0xFF ^ (0xF0 % 0x20);
|
||||
select 0xFF % 0x20 ^ 0xF0, (0xFF % 0x20) ^ 0xF0, 0xFF % (0x20 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over DIV
|
||||
select 0xFF ^ 0xF0 DIV 2, (0xFF ^ 0xF0) DIV 2, 0xFF ^ (0xF0 DIV 2);
|
||||
select 0xF2 DIV 2 ^ 0xF0, (0xF2 DIV 2) ^ 0xF0, 0xF2 DIV (2 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over MOD
|
||||
select 0xFF ^ 0xF0 MOD 0x20, (0xFF ^ 0xF0) MOD 0x20, 0xFF ^ (0xF0 MOD 0x20);
|
||||
select 0xFF MOD 0x20 ^ 0xF0, (0xFF MOD 0x20) ^ 0xF0, 0xFF MOD (0x20 ^ 0xF0);
|
||||
|
@ -7300,4 +7300,91 @@ CALL p1();
|
||||
SET NAMES default;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
#
|
||||
# Bug#29408 Cannot find view in columns table if the selection contains a function
|
||||
#
|
||||
delimiter |;
|
||||
|
||||
create function f1()
|
||||
returns int(11)
|
||||
not deterministic
|
||||
contains sql
|
||||
sql security definer
|
||||
comment ''
|
||||
begin
|
||||
declare x int(11);
|
||||
set x=-1;
|
||||
return x;
|
||||
end|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
create view v1 as select 1 as one, f1() as days;
|
||||
|
||||
connect (bug29408, localhost, root,,*NO-ONE*);
|
||||
connection bug29408;
|
||||
|
||||
show create view test.v1;
|
||||
select column_name from information_schema.columns
|
||||
where table_name='v1' and table_schema='test';
|
||||
|
||||
connection default;
|
||||
disconnect bug29408;
|
||||
drop view v1;
|
||||
drop function f1;
|
||||
|
||||
#
|
||||
# Bug#13675: DATETIME/DATE type in store proc param seems to be converted as
|
||||
# varbinary
|
||||
#
|
||||
|
||||
--echo
|
||||
--echo # Bug#13675.
|
||||
--echo
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(v DATETIME) CREATE TABLE t1 SELECT v;
|
||||
|
||||
CREATE PROCEDURE p2(v INT) CREATE TABLE t1 SELECT v;
|
||||
|
||||
--echo
|
||||
CALL p1(NOW());
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo
|
||||
CALL p1('text');
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo
|
||||
CALL p2(10);
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo
|
||||
CALL p2('text');
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -139,4 +139,36 @@ disconnect con3;
|
||||
disconnect con2;
|
||||
disconnect con1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #30377: EXPLAIN loses last_query_cost when used with UNION
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
|
||||
SELECT a FROM t1 LIMIT 1;
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
|
||||
EXPLAIN SELECT a FROM t1;
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
|
||||
SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
|
||||
EXPLAIN SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
|
||||
SELECT a IN (SELECT a FROM t1) FROM t1 LIMIT 1;
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
|
||||
SELECT (SELECT a FROM t1 LIMIT 1) x FROM t1 LIMIT 1;
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
|
||||
SELECT * FROM t1 a, t1 b LIMIT 1;
|
||||
SHOW SESSION STATUS LIKE 'Last_query_cost';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -291,4 +291,17 @@ INSERT INTO t1 (b, a) VALUES (1, 1), (3, 2), (0, 3), (3, 4);
|
||||
SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#30245: A wrong type of a BIT field is reported when grouped by it.
|
||||
#
|
||||
CREATE TABLE t1 (b BIT);
|
||||
INSERT INTO t1 (b) VALUES (1), (0);
|
||||
--enable_metadata
|
||||
--replace_column 1 #
|
||||
SELECT DISTINCT b FROM t1;
|
||||
--replace_column 1 #
|
||||
SELECT b FROM t1 GROUP BY b;
|
||||
--disable_metadata
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user