summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-11-18 22:03:02 +0100
committerSergei Golubchik <serg@mariadb.org>2015-11-18 22:03:02 +0100
commitab476a8d107b3e5b591944b2b5eb3a21d6d003a1 (patch)
tree966c077afce804cbaf0fc46ecab09c3d1da36a13
parentf91798dd1c9e178061ba58c88a42b9cb3701385d (diff)
parent43a5090980ac0ab9695587979b9068b6bf849d64 (diff)
downloadmariadb-git-ab476a8d107b3e5b591944b2b5eb3a21d6d003a1.tar.gz
Merge branch '5.5' into 10.0
-rw-r--r--mysql-test/include/default_mysqld.cnf3
-rw-r--r--mysql-test/r/update.result72
-rw-r--r--mysql-test/r/view.result33
-rw-r--r--mysql-test/suite/innodb/r/innodb-fk-warnings.result12
-rw-r--r--mysql-test/suite/innodb/r/innodb-fk.result6
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_install.result3
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_load.result3
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_send.result10
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_install.test4
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_load.test3
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_send.test21
-rw-r--r--mysql-test/t/update.test60
-rw-r--r--mysql-test/t/view.test35
-rw-r--r--plugin/feedback/feedback.cc33
-rw-r--r--plugin/feedback/feedback.h4
-rw-r--r--plugin/feedback/sender_thread.cc7
-rw-r--r--sql/item.cc3
-rw-r--r--sql/sql_select.cc6
-rw-r--r--sql/sql_view.cc5
-rw-r--r--sql/sql_yacc.yy9
-rw-r--r--storage/innobase/dict/dict0dict.cc122
-rw-r--r--storage/xtradb/dict/dict0dict.cc122
22 files changed, 382 insertions, 194 deletions
diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf
index 33881666b57..7b84117639c 100644
--- a/mysql-test/include/default_mysqld.cnf
+++ b/mysql-test/include/default_mysqld.cnf
@@ -39,6 +39,9 @@ max_heap_table_size= 1M
loose-aria-pagecache-buffer-size=8M
loose-feedback-user-info= mysql-test
+loose-feedback-debug-startup-interval=20
+loose-feedback-debug-first-interval=60
+loose-feedback-debug-interval=60
loose-innodb_data_file_path= ibdata1:12M:autoextend
loose-innodb_buffer_pool_size= 8M
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 2e883aa5680..a0c35c6e0ca 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -619,31 +619,29 @@ Handler_update 5
ROLLBACK;
DROP TABLE t1, t2;
#
-# MDEV-4410: update does not want to use a covering index, but select uses it.
+# MDEV-8938: Server Crash on Update with joins
#
-create table t2(a int);
-insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (key1 int, col1 int, key(key1));
-insert into t1
-select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;
-# This must not have "Using filesort":
-explain
-update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range key1 key1 5 NULL 2 Using where; Using buffer
-flush status;
-update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
-show status like 'Handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 1
-Handler_read_last 0
-Handler_read_next 1
-Handler_read_prev 0
-Handler_read_rnd 2
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-drop table t1, t2;
+CREATE TABLE `t1` (
+`name` varchar(255) NOT NULL,
+`value` varchar(4095) DEFAULT NULL,
+PRIMARY KEY (`name`)
+);
+UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
+drop table t1;
+CREATE TABLE `t1` (
+`name` varchar(255) NOT NULL,
+`value` varchar(4095) DEFAULT NULL,
+PRIMARY KEY (`name`)
+);
+create table t2 (
+`name` varchar(255) NOT NULL,
+`value` varchar(4095) DEFAULT NULL,
+PRIMARY KEY (`name`)
+);
+UPDATE t1
+SET value = (SELECT value FROM t2 WHERE `name`= t1.name)
+WHERE value is null ;
+drop table t1,t2;
#
#MDEV-8701: Crash on derived query
#
@@ -679,4 +677,30 @@ WHERE data_entry_exit_id = t2.data_entry_id
);
drop view v1;
drop table t1, t2;
+#
+# MDEV-4410: update does not want to use a covering index, but select uses it.
+#
+create table t2(a int);
+insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (key1 int, col1 int, key(key1));
+insert into t1
+select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;
+# This must not have "Using filesort":
+explain
+update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range key1 key1 5 NULL 2 Using where; Using buffer
+flush status;
+update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
+show status like 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_last 0
+Handler_read_next 1
+Handler_read_prev 0
+Handler_read_rnd 2
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+drop table t1, t2;
# End of MariaDB 10.0 tests
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 347d2841081..aa67013757f 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -5477,6 +5477,39 @@ UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM v3 );
EXECUTE stmt;
DROP TABLE t1, t2, t3;
DROP VIEW v3;
+#
+# MDEV-8632: Segmentation fault on INSERT
+#
+CREATE TABLE `t1` (
+`id` int(10) unsigned NOT NULL,
+`r` float NOT NULL,
+PRIMARY KEY (`id`)
+) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+create view v1 as select id, if(r=r,1,2) as d from t1;
+create view v2 as
+select id,
+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
+from v1;
+insert into t1 (id, r)
+select id,p from
+(
+select id,
+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
+from (
+select id, if(r=r,1,2) as d
+from t1
+) a
+) b
+on duplicate key update r=p;
+insert into t1 (id, r)
+select id,p from v2
+on duplicate key update r=p;
+prepare stmt from "insert into t1 (id, r) select id,p from v2 on duplicate key update r=p";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+drop view v1,v2;
+drop table `t1`;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/suite/innodb/r/innodb-fk-warnings.result b/mysql-test/suite/innodb/r/innodb-fk-warnings.result
index a022f07936c..eddedfc3620 100644
--- a/mysql-test/suite/innodb/r/innodb-fk-warnings.result
+++ b/mysql-test/suite/innodb/r/innodb-fk-warnings.result
@@ -25,7 +25,7 @@ create table t2(a int, constraint a foreign key a (a) references t1(a)) engine=i
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
-Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to foreign key a (a) references t1(a)) engine=innodb.
+Warning 150 Create table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key a (a) references t1(a)) engine=innodb'.
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t1;
@@ -42,7 +42,7 @@ alter table t2 add constraint b foreign key (b) references t2(b);
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
-Warning 150 Alter table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to foreign key (b) references t2(b).
+Warning 150 Alter table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key (b) references t2(b)'.
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t2, t1;
@@ -51,7 +51,7 @@ alter table t1 add constraint c1 foreign key (f1) references t11(f1);
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
-Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary close to foreign key (f1) references t11(f1).
+Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary near ' foreign key (f1) references t11(f1)'.
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t1;
@@ -90,14 +90,14 @@ alter table t1 add constraint c1 foreign key (f1) references t1(f1) on update se
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
-Warning 150 Alter table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column f1 is defined as NOT NULL in foreign key (f1) references t1(f1) on update set null close to on update set null.
+Warning 150 Alter table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column 'f1' is defined as NOT NULL in ' foreign key (f1) references t1(f1) on update set null' near ' on update set null'.
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
-Warning 150 Create table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column a is defined as NOT NULL in foreign key(a) references t1(f1) on delete set null) engine=innodb close to on delete set null) engine=innodb.
+Warning 150 Create table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column 'a' is defined as NOT NULL in 'foreign key(a) references t1(f1) on delete set null) engine=innodb' near ' on delete set null) engine=innodb'.
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t1;
@@ -106,7 +106,7 @@ create table t2(a char(20), key(a), foreign key(a) references t1(f1)) engine=inn
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
-Warning 150 Create table `test`.`t2` with foreign key constraint failed. Field type or character set for column a does not mach referenced column f1 close to foreign key(a) references t1(f1)) engine=innodb
+Warning 150 Create table `test`.`t2` with foreign key constraint failed. Field type or character set for column 'a' does not mach referenced column 'f1' near 'foreign key(a) references t1(f1)) engine=innodb'.
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result
index dee20d282f7..c916d665bf0 100644
--- a/mysql-test/suite/innodb/r/innodb-fk.result
+++ b/mysql-test/suite/innodb/r/innodb-fk.result
@@ -50,8 +50,8 @@ CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
-Warning 150 Create table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
-) ENGINE=InnoDB.
+Warning 150 Create table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
+) ENGINE=InnoDB'.
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
CREATE TABLE t2 (
@@ -65,7 +65,7 @@ ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
-Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE.
+Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE'.
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
drop table t2;
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_install.result b/mysql-test/suite/plugins/r/feedback_plugin_install.result
index 37d26b48501..c52fdb8f85b 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_install.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_install.result
@@ -3,7 +3,8 @@ select plugin_status from information_schema.plugins where plugin_name='feedback
plugin_status
ACTIVE
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid';
+ and variable_name not like '%_uid'
+ and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK used 1
FEEDBACK version 1.1
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_load.result b/mysql-test/suite/plugins/r/feedback_plugin_load.result
index fa8724c321d..58507036af2 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_load.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_load.result
@@ -6,7 +6,8 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
variable_value = @feedback_used + 1
1
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
+ and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
+ and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result
index c4ad3717a16..8f3f33076da 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_send.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_send.result
@@ -6,7 +6,8 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
variable_value = @feedback_used + 1
1
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
+ and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
+ and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
@@ -22,7 +23,6 @@ VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used latin1_swedish_ci
1 Collation used utf8_bin
1 Collation used utf8_general_ci
-feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
-feedback plugin: server replied 'ok'
-feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
-feedback plugin: server replied 'ok'
+set global sql_mode=ONLY_FULL_GROUP_BY;
+6: feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
+6: feedback plugin: server replied 'ok'
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_install.test b/mysql-test/suite/plugins/t/feedback_plugin_install.test
index 81343c436c3..559dcebfc05 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_install.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_install.test
@@ -10,6 +10,8 @@ select plugin_status from information_schema.plugins where plugin_name='feedback
--replace_result https http
--sorted_result
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid';
+ and variable_name not like '%_uid'
+ and variable_name not like '%debug%';
+
uninstall plugin feedback;
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_load.test b/mysql-test/suite/plugins/t/feedback_plugin_load.test
index f2f8c1f97a7..8b4aee28362 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_load.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_load.test
@@ -24,7 +24,8 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
--replace_result https http
--sorted_result
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
+ and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
+ and variable_name not like '%debug%';
# Embedded server does not use the table mysqld.user and thus
# does not automatically use latin1_bin on startup. Use it manually.
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_send.test b/mysql-test/suite/plugins/t/feedback_plugin_send.test
index 31542c33482..b28f9d4cb38 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_send.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_send.test
@@ -13,7 +13,11 @@ if (!$MTR_FEEDBACK_PLUGIN) {
# Let's wait, and hope that mtr is started with --parallel and
# is doing some work in other workers.
#
-sleep 310;
+
+sleep 100;
+set global sql_mode=ONLY_FULL_GROUP_BY;
+sleep 210;
+
# The test expects that the plugin will send a report at least 2 times,
# now (5 min after loading) and on server shutdown which happens below.
@@ -25,20 +29,15 @@ sleep 310;
--let $shutdown_timeout= 60
source include/restart_mysqld.inc;
-replace_result https http;
+replace_result https http 2 6;
perl;
$log_error= $ENV{'MYSQLTEST_VARDIR'} . '/log/mysqld.1.err';
open(LOG, '<', $log_error) or die "open(< $log_error): $!";
- # Get the first few rows (as there may be different number rows in the log)
- $i= 0;
- while ($_=<LOG>)
- {
- if (/feedback plugin:.*/)
- {
- print "$&\n";
- break if ($i++ >= 3);
- }
+ %logg=();
+ while ($_=<LOG>) {
+ $logg{$&}++ if /feedback plugin:.*/;
}
+ print "$logg{$_}: $_\n" for sort keys %logg;
close LOG;
EOF
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index c0334a75bff..e5ef0b11127 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -560,25 +560,36 @@ ROLLBACK;
DROP TABLE t1, t2;
--echo #
---echo # MDEV-4410: update does not want to use a covering index, but select uses it.
+--echo # MDEV-8938: Server Crash on Update with joins
--echo #
-create table t2(a int);
-insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (key1 int, col1 int, key(key1));
-insert into t1
-select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;
+CREATE TABLE `t1` (
+ `name` varchar(255) NOT NULL,
+ `value` varchar(4095) DEFAULT NULL,
+ PRIMARY KEY (`name`)
+);
---echo # This must not have "Using filesort":
-explain
-update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
+UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
-flush status;
-update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
-# Handler_read_next should be 1 (due to LIMIT), not 100:
-show status like 'Handler_read%';
+drop table t1;
-drop table t1, t2;
+CREATE TABLE `t1` (
+ `name` varchar(255) NOT NULL,
+ `value` varchar(4095) DEFAULT NULL,
+ PRIMARY KEY (`name`)
+);
+
+create table t2 (
+ `name` varchar(255) NOT NULL,
+ `value` varchar(4095) DEFAULT NULL,
+ PRIMARY KEY (`name`)
+);
+
+UPDATE t1
+SET value = (SELECT value FROM t2 WHERE `name`= t1.name)
+WHERE value is null ;
+
+drop table t1,t2;
--echo #
--echo #MDEV-8701: Crash on derived query
@@ -621,4 +632,25 @@ SET data_entry_cost
drop view v1;
drop table t1, t2;
+--echo #
+--echo # MDEV-4410: update does not want to use a covering index, but select uses it.
+--echo #
+create table t2(a int);
+insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1 (key1 int, col1 int, key(key1));
+insert into t1
+select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;
+
+--echo # This must not have "Using filesort":
+explain
+update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
+
+flush status;
+update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
+# Handler_read_next should be 1 (due to LIMIT), not 100:
+show status like 'Handler_read%';
+
+drop table t1, t2;
+
--echo # End of MariaDB 10.0 tests
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 6c99d2217c2..d8e7ad051d7 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -5445,6 +5445,41 @@ EXECUTE stmt;
DROP TABLE t1, t2, t3;
DROP VIEW v3;
+--echo #
+--echo # MDEV-8632: Segmentation fault on INSERT
+--echo #
+CREATE TABLE `t1` (
+ `id` int(10) unsigned NOT NULL,
+ `r` float NOT NULL,
+ PRIMARY KEY (`id`)
+) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+create view v1 as select id, if(r=r,1,2) as d from t1;
+create view v2 as
+ select id,
+ d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
+ from v1;
+insert into t1 (id, r)
+select id,p from
+(
+ select id,
+ d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
+ from (
+ select id, if(r=r,1,2) as d
+ from t1
+ ) a
+) b
+on duplicate key update r=p;
+insert into t1 (id, r)
+select id,p from v2
+on duplicate key update r=p;
+
+prepare stmt from "insert into t1 (id, r) select id,p from v2 on duplicate key update r=p";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop view v1,v2;
+drop table `t1`;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index f644bd597d9..1a2504c5f6f 100644
--- a/plugin/feedback/feedback.cc
+++ b/plugin/feedback/feedback.cc
@@ -22,6 +22,10 @@ extern ST_SCHEMA_TABLE schema_tables[];
namespace feedback {
+#ifndef DBUG_OFF
+ulong debug_startup_interval, debug_first_interval, debug_interval;
+#endif
+
char server_uid_buf[SERVER_UID_SIZE+1]; ///< server uid will be written here
/* backing store for system variables */
@@ -250,6 +254,18 @@ static int init(void *p)
prepare_linux_info();
+#ifndef DBUG_OFF
+ if (startup_interval != debug_startup_interval ||
+ first_interval != debug_first_interval ||
+ interval != debug_interval)
+ {
+ startup_interval= debug_startup_interval;
+ first_interval= debug_first_interval;
+ interval= debug_interval;
+ user_info= "mysql-test";
+ }
+#endif
+
url_count= 0;
if (*url)
{
@@ -348,12 +364,29 @@ static MYSQL_SYSVAR_ULONG(send_retry_wait, send_retry_wait, PLUGIN_VAR_RQCMDARG,
"Wait this many seconds before retrying a failed send.",
NULL, NULL, 60, 1, 60*60*24, 1);
+#ifndef DBUG_OFF
+static MYSQL_SYSVAR_ULONG(debug_startup_interval, debug_startup_interval,
+ PLUGIN_VAR_RQCMDARG, "for debugging only",
+ NULL, NULL, startup_interval, 1, INT_MAX32, 1);
+static MYSQL_SYSVAR_ULONG(debug_first_interval, debug_first_interval,
+ PLUGIN_VAR_RQCMDARG, "for debugging only",
+ NULL, NULL, first_interval, 1, INT_MAX32, 1);
+static MYSQL_SYSVAR_ULONG(debug_interval, debug_interval,
+ PLUGIN_VAR_RQCMDARG, "for debugging only",
+ NULL, NULL, interval, 1, INT_MAX32, 1);
+#endif
+
static struct st_mysql_sys_var* settings[] = {
MYSQL_SYSVAR(server_uid),
MYSQL_SYSVAR(user_info),
MYSQL_SYSVAR(url),
MYSQL_SYSVAR(send_timeout),
MYSQL_SYSVAR(send_retry_wait),
+#ifndef DBUG_OFF
+ MYSQL_SYSVAR(debug_startup_interval),
+ MYSQL_SYSVAR(debug_first_interval),
+ MYSQL_SYSVAR(debug_interval),
+#endif
NULL
};
diff --git a/plugin/feedback/feedback.h b/plugin/feedback/feedback.h
index c2091afdedc..52ab32dfb2b 100644
--- a/plugin/feedback/feedback.h
+++ b/plugin/feedback/feedback.h
@@ -59,6 +59,10 @@ class Url {
extern Url **urls;
extern uint url_count;
+extern time_t startup_interval;
+extern time_t first_interval;
+extern time_t interval;
+
/* these are used to communicate with the background thread */
extern mysql_mutex_t sleep_mutex;
extern mysql_cond_t sleep_condition;
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc
index 465bdfa8feb..415c1f2e3c2 100644
--- a/plugin/feedback/sender_thread.cc
+++ b/plugin/feedback/sender_thread.cc
@@ -25,9 +25,9 @@ static my_thread_id thd_thread_id; ///< its thread_id
static size_t needed_size= 20480;
-static const time_t startup_interval= 60*5; ///< in seconds (5 minutes)
-static const time_t first_interval= 60*60*24; ///< in seconds (one day)
-static const time_t interval= 60*60*24*7; ///< in seconds (one week)
+time_t startup_interval= 60*5; ///< in seconds (5 minutes)
+time_t first_interval= 60*60*24; ///< in seconds (one day)
+time_t interval= 60*60*24*7; ///< in seconds (one week)
/**
reads the rows from a table and puts them, concatenated, in a String
@@ -124,6 +124,7 @@ static int prepare_for_fill(TABLE_LIST *tables)
if (!tables->table)
return 1;
+ tables->select_lex= thd->lex->current_select;
tables->table->pos_in_table_list= tables;
return 0;
diff --git a/sql/item.cc b/sql/item.cc
index 543ea4f0ffb..af6915d7468 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1884,6 +1884,8 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
*/
Item_aggregate_ref *item_ref;
uint el= fields.elements;
+ DBUG_ASSERT(fields.elements <=
+ thd->lex->current_select->ref_pointer_array_size);
/*
If this is an item_ref, get the original item
This is a safety measure if this is called for things that is
@@ -6716,6 +6718,7 @@ Item *Item_field::update_value_transformer(uchar *select_arg)
{
List<Item> *all_fields= &select->join->all_fields;
Item **ref_pointer_array= select->ref_pointer_array;
+ DBUG_ASSERT(all_fields->elements <= select->ref_pointer_array_size);
int el= all_fields->elements;
Item_ref *ref;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index edfd9f5ebd3..479d9a62d11 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -481,6 +481,7 @@ fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
if (ref_pointer_array && !ref->found_in_select_list)
{
int el= all_fields.elements;
+ DBUG_ASSERT(all_fields.elements <= select->ref_pointer_array_size);
ref_pointer_array[el]= item;
/* Add the field item to the select list of the current select. */
all_fields.push_front(item);
@@ -895,6 +896,7 @@ JOIN::prepare(Item ***rref_pointer_array,
{
Item_field *field= new Item_field(thd, *(Item_field**)ord->item);
int el= all_fields.elements;
+ DBUG_ASSERT(all_fields.elements <= select_lex->ref_pointer_array_size);
ref_pointer_array[el]= field;
all_fields.push_front(field);
ord->item= ref_pointer_array + el;
@@ -21443,6 +21445,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
return TRUE; /* Wrong field. */
uint el= all_fields.elements;
+ DBUG_ASSERT(all_fields.elements <=
+ thd->lex->current_select->ref_pointer_array_size);
all_fields.push_front(order_item); /* Add new field to field list. */
ref_pointer_array[el]= order_item;
/*
@@ -21702,6 +21706,8 @@ create_distinct_group(THD *thd, Item **ref_pointer_array,
*/
Item_field *new_item= new Item_field(thd, (Item_field*)item);
int el= all_fields.elements;
+ DBUG_ASSERT(all_fields.elements <=
+ thd->lex->current_select->ref_pointer_array_size);
orig_ref_pointer_array[el]= new_item;
all_fields.push_front(new_item);
ord->item= orig_ref_pointer_array + el;
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index a63d8a51a86..3814d58ed75 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1493,6 +1493,11 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
*/
lex->sql_command= old_lex->sql_command;
lex->duplicates= old_lex->duplicates;
+
+ /* Fields in this view can be used in upper select in case of merge. */
+ if (table->select_lex)
+ table->select_lex->select_n_where_fields+=
+ lex->select_lex.select_n_where_fields;
}
/*
This method has a dependency on the proper lock type being set,
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index c6797278e02..8e849d76070 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -10763,6 +10763,15 @@ table_factor:
sel->add_joined_table($$);
lex->pop_context();
lex->nest_level--;
+ /*
+ Fields in derived table can be used in upper select in
+ case of merge. We do not add HAVING fields because we do
+ not merge such derived. We do not add union because
+ also do not merge them
+ */
+ if (!sel->next_select())
+ $2->select_n_where_fields+=
+ sel->select_n_where_fields;
}
/*else if (($3->select_lex &&
$3->select_lex->master_unit()->is_union() &&
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 7982671a3ef..0ceee0622b1 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -4289,13 +4289,13 @@ dict_foreign_push_index_error(
"%s table '%s' with foreign key constraint"
" failed. There is no index in the referenced"
" table where the referenced columns appear"
- " as the first columns. Error close to %s.\n",
+ " as the first columns near '%s'.\n",
operation, create_name, latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table '%s' with foreign key constraint"
" failed. There is no index in the referenced"
" table where the referenced columns appear"
- " as the first columns. Error close to %s.",
+ " as the first columns near '%s'.",
operation, create_name, latest_foreign);
break;
}
@@ -4304,13 +4304,13 @@ dict_foreign_push_index_error(
"%s table '%s' with foreign key constraint"
" failed. There is only prefix index in the referenced"
" table where the referenced columns appear"
- " as the first columns. Error close to %s.\n",
+ " as the first columns near '%s'.\n",
operation, create_name, latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table '%s' with foreign key constraint"
" failed. There is only prefix index in the referenced"
" table where the referenced columns appear"
- " as the first columns. Error close to %s.",
+ " as the first columns near '%s'.",
operation, create_name, latest_foreign);
break;
}
@@ -4318,12 +4318,12 @@ dict_foreign_push_index_error(
fprintf(ef,
"%s table %s with foreign key constraint"
" failed. You have defined a SET NULL condition but "
- "field %s on index is defined as NOT NULL close to %s\n",
+ "column '%s' on index is defined as NOT NULL near '%s'.\n",
operation, create_name, columns[err_col], latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
" failed. You have defined a SET NULL condition but "
- "field %s on index is defined as NOT NULL close to %s",
+ "column '%s' on index is defined as NOT NULL near '%s'.",
operation, create_name, columns[err_col], latest_foreign);
break;
}
@@ -4336,13 +4336,13 @@ dict_foreign_push_index_error(
table, dict_col_get_no(field->col));
fprintf(ef,
"%s table %s with foreign key constraint"
- " failed. Field type or character set for column %s "
- "does not mach referenced column %s close to %s\n",
+ " failed. Field type or character set for column '%s' "
+ "does not mach referenced column '%s' near '%s'.\n",
operation, create_name, columns[err_col], col_name, latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Field type or character set for column %s "
- "does not mach referenced column %s close to %s",
+ " failed. Field type or character set for column '%s' "
+ "does not mach referenced column '%s' near '%s'.",
operation, create_name, columns[err_col], col_name, latest_foreign);
break;
}
@@ -4676,14 +4676,14 @@ loop:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4720,16 +4720,16 @@ col_loop1:
dict_foreign_error_report_low(ef, create_name);
fprintf(ef,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
mutex_exit(&dict_foreign_err_mutex);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4749,14 +4749,14 @@ col_loop1:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4795,14 +4795,14 @@ col_loop1:
if (!success || !my_isspace(cs, *ptr)) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4882,13 +4882,13 @@ col_loop1:
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
- "close to %s.",
+ "near '%s'.",
operation, create_name, buf, start_of_latest_foreign);
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, create_name);
fprintf(ef,
"%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
- "close to %s.\n",
+ "near '%s'.\n",
operation, create_name, buf, start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
@@ -4902,14 +4902,14 @@ col_loop1:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4930,14 +4930,14 @@ col_loop2:
dict_foreign_error_report_low(ef, create_name);
fprintf(ef,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
mutex_exit(&dict_foreign_err_mutex);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4957,14 +4957,12 @@ col_loop2:
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s. Too few referenced columns.\n",
+ " failed. Parse error in '%s' near '%s'. Referencing column count does not match referenced column count.\n",
operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s. Too few referenced columns, you have %d when you should have %d.",
+ " failed. Parse error in '%s' near '%s'. Referencing column count %d does not match referenced column count %d.\n",
operation, create_name, start_of_latest_foreign, orig, i, foreign->n_fields);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4995,14 +4993,14 @@ scan_on_conditions:
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -5045,14 +5043,14 @@ scan_on_conditions:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -5073,14 +5071,14 @@ scan_on_conditions:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -5091,14 +5089,14 @@ scan_on_conditions:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -5119,15 +5117,15 @@ scan_on_conditions:
dict_foreign_error_report_low(ef, create_name);
fprintf(ef,
"%s table %s with foreign key constraint"
- " failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
- " in %s close to %s.\n",
+ " failed. You have defined a SET NULL condition but column '%s' is defined as NOT NULL"
+ " in '%s' near '%s'.\n",
operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
mutex_exit(&dict_foreign_err_mutex);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
- " in %s close to %s.",
+ " failed. You have defined a SET NULL condition but column '%s' is defined as NOT NULL"
+ " in '%s' near '%s'.",
operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -5151,13 +5149,13 @@ try_find_index:
fprintf(ef,
"%s table %s with foreign key constraint"
" failed. You have more than one on delete or on update clause"
- " in %s close to %s.\n",
+ " in '%s' near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
" failed. You have more than one on delete or on update clause"
- " in %s close to %s.",
+ " in '%s' near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
dict_foreign_free(foreign);
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index 01c5453f351..3b3b6495639 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -4251,13 +4251,13 @@ dict_foreign_push_index_error(
"%s table '%s' with foreign key constraint"
" failed. There is no index in the referenced"
" table where the referenced columns appear"
- " as the first columns. Error close to %s.\n",
+ " as the first columns near '%s'.\n",
operation, create_name, latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table '%s' with foreign key constraint"
" failed. There is no index in the referenced"
" table where the referenced columns appear"
- " as the first columns. Error close to %s.",
+ " as the first columns near '%s'.",
operation, create_name, latest_foreign);
break;
}
@@ -4266,13 +4266,13 @@ dict_foreign_push_index_error(
"%s table '%s' with foreign key constraint"
" failed. There is only prefix index in the referenced"
" table where the referenced columns appear"
- " as the first columns. Error close to %s.\n",
+ " as the first columns near '%s'.\n",
operation, create_name, latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table '%s' with foreign key constraint"
" failed. There is only prefix index in the referenced"
" table where the referenced columns appear"
- " as the first columns. Error close to %s.",
+ " as the first columns near '%s'.",
operation, create_name, latest_foreign);
break;
}
@@ -4280,12 +4280,12 @@ dict_foreign_push_index_error(
fprintf(ef,
"%s table %s with foreign key constraint"
" failed. You have defined a SET NULL condition but "
- "field %s on index is defined as NOT NULL close to %s\n",
+ "column '%s' on index is defined as NOT NULL near '%s'.\n",
operation, create_name, columns[err_col], latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
" failed. You have defined a SET NULL condition but "
- "field %s on index is defined as NOT NULL close to %s",
+ "column '%s' on index is defined as NOT NULL near '%s'.",
operation, create_name, columns[err_col], latest_foreign);
break;
}
@@ -4298,13 +4298,13 @@ dict_foreign_push_index_error(
table, dict_col_get_no(field->col));
fprintf(ef,
"%s table %s with foreign key constraint"
- " failed. Field type or character set for column %s "
- "does not mach referenced column %s close to %s\n",
+ " failed. Field type or character set for column '%s' "
+ "does not mach referenced column '%s' near '%s'.\n",
operation, create_name, columns[err_col], col_name, latest_foreign);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Field type or character set for column %s "
- "does not mach referenced column %s close to %s",
+ " failed. Field type or character set for column '%s' "
+ "does not mach referenced column '%s' near '%s'.",
operation, create_name, columns[err_col], col_name, latest_foreign);
break;
}
@@ -4638,14 +4638,14 @@ loop:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4682,16 +4682,16 @@ col_loop1:
dict_foreign_error_report_low(ef, create_name);
fprintf(ef,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
mutex_exit(&dict_foreign_err_mutex);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4711,14 +4711,14 @@ col_loop1:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4757,14 +4757,14 @@ col_loop1:
if (!success || !my_isspace(cs, *ptr)) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -4844,13 +4844,13 @@ col_loop1:
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
- "close to %s.",
+ "near '%s'.",
operation, create_name, buf, start_of_latest_foreign);
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, create_name);
fprintf(ef,
"%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
- "close to %s.\n",
+ "near '%s'.\n",
operation, create_name, buf, start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
@@ -4864,14 +4864,14 @@ col_loop1:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4892,14 +4892,14 @@ col_loop2:
dict_foreign_error_report_low(ef, create_name);
fprintf(ef,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, orig);
mutex_exit(&dict_foreign_err_mutex);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, orig);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4919,14 +4919,12 @@ col_loop2:
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s. Too few referenced columns.\n",
+ " failed. Parse error in '%s' near '%s'. Referencing column count does not match referenced column count.\n",
operation, create_name, start_of_latest_foreign, orig);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s. Too few referenced columns, you have %d when you should have %d.",
+ " failed. Parse error in '%s' near '%s'. Referencing column count %d does not match referenced column count %d.\n",
operation, create_name, start_of_latest_foreign, orig, i, foreign->n_fields);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4957,14 +4955,14 @@ scan_on_conditions:
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -5007,14 +5005,14 @@ scan_on_conditions:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -5035,14 +5033,14 @@ scan_on_conditions:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -5053,14 +5051,14 @@ scan_on_conditions:
if (!success) {
dict_foreign_report_syntax_err(
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.\n",
+ " failed. Parse error in '%s'"
+ " near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. Foreign key constraint parse error in %s"
- " close to %s.",
+ " failed. Parse error in '%s'"
+ " near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -5081,15 +5079,15 @@ scan_on_conditions:
dict_foreign_error_report_low(ef, create_name);
fprintf(ef,
"%s table %s with foreign key constraint"
- " failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
- " in %s close to %s.\n",
+ " failed. You have defined a SET NULL condition but column '%s' is defined as NOT NULL"
+ " in '%s' near '%s'.\n",
operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
mutex_exit(&dict_foreign_err_mutex);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
- " failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
- " in %s close to %s.",
+ " failed. You have defined a SET NULL condition but column '%s' is defined as NOT NULL"
+ " in '%s' near '%s'.",
operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -5113,13 +5111,13 @@ try_find_index:
fprintf(ef,
"%s table %s with foreign key constraint"
" failed. You have more than one on delete or on update clause"
- " in %s close to %s.\n",
+ " in '%s' near '%s'.\n",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
"%s table %s with foreign key constraint"
" failed. You have more than one on delete or on update clause"
- " in %s close to %s.",
+ " in '%s' near '%s'.",
operation, create_name, start_of_latest_foreign, start_of_latest_set);
dict_foreign_free(foreign);