Commit 5e23b634 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-10506 Protocol::end_statement(): Assertion `0' failed upon ALTER TABLE

thd->clear_error() destroyed already existing error status
parent 93d5cdf0
CREATE TABLE t1 (
pk INT AUTO_INCREMENT,
i INT,
d DATE,
dt DATETIME,
v VARCHAR(1),
PRIMARY KEY (pk),
KEY (dt)
) ENGINE=MyISAM;
INSERT INTO t1 (i, d, dt, v) VALUES
(9, '2005-07-23', '2004-05-13 01:01:39', 't'),
(2, '2009-11-01', '2003-12-24 07:39:29', 'h'),
(6, NULL, '2008-07-03 05:32:22', 'l'),
(6, '2007-07-16', '2008-08-28 18:46:11', 'j'),
(5, NULL, '2001-07-12 21:27:00', 'h'),
(3, '2007-07-22', '1900-01-01 00:00:00', 'p'),
(2, '2000-11-21', '2007-05-25 11:58:54', 'g'),
(6, '1900-01-01', '2009-06-03 17:11:10', 'i'),
(2, '2008-02-10', '2001-06-15 16:20:07', 'p'),
(3, '2009-06-04', '1900-01-01 00:00:00', 'h'),
(9, '2007-04-25', '1900-01-01 00:00:00', 'e'),
(9, '2006-03-02', '1900-01-01 00:00:00', 'e'),
(1, '1900-01-01', '2002-11-08 09:33:27', 'u'),
(7, '2008-07-13', '2007-08-07 17:35:52', 'j'),
(0, '2004-11-12', '2006-05-01 00:00:00', 'e'),
(0, '1900-01-01', '2003-05-01 00:00:00', 'z'),
(1, '2009-09-02', '2007-02-12 09:30:49', 'w'),
(0, '2004-11-06', '1900-01-01 00:00:00', 't'),
(4, '2003-01-06', '2002-07-03 02:51:11', 'i'),
(6, '2006-01-14', '2008-02-26 04:57:32', 'i'),
(0, '2002-01-19', '2009-02-12 00:00:00', 'i'),
(8, '2007-02-12', '1900-01-01 00:00:00', 'b'),
(4, '1900-01-01', '2001-05-16 05:28:40', 'm'),
(2, '2005-07-16', NULL, 'j'),
(1, '2004-09-04', '2001-01-24 21:45:18', 'v'),
(3, '2009-07-01', NULL, NULL),
(2, '2009-07-21', '2002-07-24 00:00:00', 'h'),
(4, NULL, '2001-11-03 12:22:30', 'q'),
(1, '2002-06-22', '2008-06-17 03:17:59', 'f'),
(7, '2005-06-23', '2005-12-24 00:00:00', 'p'),
(6, '2001-05-20', '2008-10-23 00:00:00', NULL),
(3, '2001-10-01', '2000-10-12 16:32:35', 'o'),
(3, '2001-01-07', '2005-09-11 10:09:54', 'w'),
(6, '2007-11-02', '2009-09-10 01:44:18', 'l'),
(6, NULL, NULL, 'i'),
(9, NULL, '2002-05-18 15:21:55', 'd'),
(4, '2008-12-21', '2004-10-15 10:09:54', 'j'),
(6, '2003-10-05', '2009-07-13 03:51:02', 'e'),
(2, '2001-03-03', '1900-01-01 00:00:00', 'e'),
(2, '2007-04-04', '2001-11-08 21:14:52', 'q'),
(5, NULL, '2006-12-02 00:00:00', 'm'),
(0, '2009-01-04', '1900-01-01 00:00:00', NULL),
(8, '2008-04-03', '2005-01-01 11:55:18', 'q'),
(8, NULL, '2005-02-28 03:44:02', 'w'),
(0, '2003-08-22', NULL, 'c'),
(9, '1900-01-01', NULL, 'y'),
(NULL, NULL, '2006-08-25 16:28:09', 'g'),
(5, '2004-07-04', '2002-08-11 00:00:00', 'z'),
(1, '1900-01-01', '2007-07-22 21:19:18', 'm'),
(2, '2007-02-04', '2006-02-10 18:41:38', 't'),
(2, '1900-01-01', '2009-02-16 14:58:58', 'd'),
(7, '2001-03-14', '2007-08-14 00:00:00', 'h'),
(0, NULL, '1900-01-01 00:00:00', NULL),
(1, '2008-10-05', NULL, 'f'),
(6, '2001-11-25', '2008-12-03 06:59:23', 'l'),
(NULL, '2003-01-27', '2008-10-04 00:00:00', 'g'),
(8, '2008-08-08', '2009-07-07 07:00:21', 'v'),
(8, '2006-07-03', '2001-04-15 00:00:00', NULL),
(5, '2002-11-21', '2007-07-08 04:01:58', 'm'),
(5, '2006-04-08', '2007-09-23 00:01:35', 'i'),
(5, '2001-05-06', '2008-05-15 00:00:00', 'h'),
(7, '1900-01-01', '1900-01-01 00:00:00', 'u'),
(30, '2007-04-16', '2004-03-05 23:35:38', 'o'),
(NULL, '1900-01-01', '2007-08-25 01:32:47', 'z'),
(6, '2004-12-03', '1900-01-01 00:00:00', 'o'),
(8, '2001-06-23', '1900-01-01 00:00:00', 'f'),
(NULL, '2008-12-15', '2001-05-19 08:28:28', 'a'),
(9, '2000-02-15', '2009-09-03 06:07:22', 'd'),
(2, '2001-08-05', '2006-10-08 07:17:27', 'k'),
(5, '2004-01-17', '2003-09-06 20:36:01', 'd'),
(4, '2003-10-01', '2001-02-05 18:10:49', 'u'),
(4, '2003-07-28', '2001-01-07 16:11:37', 'h'),
(0, '1900-01-01', '2008-08-01 05:26:38', 'w'),
(9, '1900-01-01', '2001-05-08 00:00:00', 't'),
(1, '2000-04-17', '2008-07-10 21:26:28', 'i'),
(8, '2002-01-05', '2006-08-06 20:56:35', 'k'),
(9, '2001-04-10', '2003-02-17 00:00:00', 'z'),
(0, '2009-12-04', NULL, 'h'),
(7, NULL, '2004-10-27 00:29:57', 'h'),
(2, '2006-03-07', '2008-03-04 06:14:13', 'b'),
(0, '2001-10-15', '2001-03-17 00:00:00', 'm'),
(5, '1900-01-01', '2009-02-21 11:35:50', 'i'),
(4, NULL, '1900-01-01 00:00:00', 'w'),
(5, '2009-04-05', '1900-01-01 00:00:00', 'm'),
(6, '2001-03-19', '2001-04-12 00:00:00', 'q'),
(NULL, '2009-12-08', '2001-12-04 20:21:01', 'k'),
(2, '2005-02-09', '2001-05-27 08:41:01', 'l'),
(9, '2004-05-25', '2004-09-18 00:00:00', 'c'),
(3, '2005-01-17', '2002-09-12 11:18:48', 'd'),
(0, '2003-08-28', '1900-01-01 00:00:00', 'k'),
(6, '2006-10-11', '2003-10-28 03:31:02', 'a'),
(5, '1900-01-01', '2001-08-22 10:20:09', 'p'),
(8, '1900-01-01', '2008-04-24 00:00:00', 'o'),
(4, '2005-08-18', '2006-11-10 10:08:49', 'e'),
(NULL, '2007-03-12', '2007-10-16 00:00:00', 'n'),
(1, '2000-11-18', '2009-05-27 12:25:07', 't'),
(4, '2001-03-03', NULL, 'u'),
(3, '2003-09-11', '2001-09-10 18:10:10', 'f'),
(4, '2007-06-17', '1900-01-01 00:00:00', 't'),
(NULL, '2008-09-11', '2004-06-07 23:17:09', 'k');
ALTER TABLE t1 ADD UNIQUE KEY ind1 (pk, d, i, v);
ALTER TABLE t1 ADD UNIQUE KEY ind2 (d, v);
ERROR 23000: Duplicate entry '1900-01-01-m' for key 'ind2'
DROP TABLE t1;
#
# MDEV-10506 Protocol::end_statement(): Assertion `0' failed upon ALTER TABLE
#
CREATE TABLE t1 (
pk INT AUTO_INCREMENT,
i INT,
d DATE,
dt DATETIME,
v VARCHAR(1),
PRIMARY KEY (pk),
KEY (dt)
) ENGINE=MyISAM;
INSERT INTO t1 (i, d, dt, v) VALUES
(9, '2005-07-23', '2004-05-13 01:01:39', 't'),
(2, '2009-11-01', '2003-12-24 07:39:29', 'h'),
(6, NULL, '2008-07-03 05:32:22', 'l'),
(6, '2007-07-16', '2008-08-28 18:46:11', 'j'),
(5, NULL, '2001-07-12 21:27:00', 'h'),
(3, '2007-07-22', '1900-01-01 00:00:00', 'p'),
(2, '2000-11-21', '2007-05-25 11:58:54', 'g'),
(6, '1900-01-01', '2009-06-03 17:11:10', 'i'),
(2, '2008-02-10', '2001-06-15 16:20:07', 'p'),
(3, '2009-06-04', '1900-01-01 00:00:00', 'h'),
(9, '2007-04-25', '1900-01-01 00:00:00', 'e'),
(9, '2006-03-02', '1900-01-01 00:00:00', 'e'),
(1, '1900-01-01', '2002-11-08 09:33:27', 'u'),
(7, '2008-07-13', '2007-08-07 17:35:52', 'j'),
(0, '2004-11-12', '2006-05-01 00:00:00', 'e'),
(0, '1900-01-01', '2003-05-01 00:00:00', 'z'),
(1, '2009-09-02', '2007-02-12 09:30:49', 'w'),
(0, '2004-11-06', '1900-01-01 00:00:00', 't'),
(4, '2003-01-06', '2002-07-03 02:51:11', 'i'),
(6, '2006-01-14', '2008-02-26 04:57:32', 'i'),
(0, '2002-01-19', '2009-02-12 00:00:00', 'i'),
(8, '2007-02-12', '1900-01-01 00:00:00', 'b'),
(4, '1900-01-01', '2001-05-16 05:28:40', 'm'),
(2, '2005-07-16', NULL, 'j'),
(1, '2004-09-04', '2001-01-24 21:45:18', 'v'),
(3, '2009-07-01', NULL, NULL),
(2, '2009-07-21', '2002-07-24 00:00:00', 'h'),
(4, NULL, '2001-11-03 12:22:30', 'q'),
(1, '2002-06-22', '2008-06-17 03:17:59', 'f'),
(7, '2005-06-23', '2005-12-24 00:00:00', 'p'),
(6, '2001-05-20', '2008-10-23 00:00:00', NULL),
(3, '2001-10-01', '2000-10-12 16:32:35', 'o'),
(3, '2001-01-07', '2005-09-11 10:09:54', 'w'),
(6, '2007-11-02', '2009-09-10 01:44:18', 'l'),
(6, NULL, NULL, 'i'),
(9, NULL, '2002-05-18 15:21:55', 'd'),
(4, '2008-12-21', '2004-10-15 10:09:54', 'j'),
(6, '2003-10-05', '2009-07-13 03:51:02', 'e'),
(2, '2001-03-03', '1900-01-01 00:00:00', 'e'),
(2, '2007-04-04', '2001-11-08 21:14:52', 'q'),
(5, NULL, '2006-12-02 00:00:00', 'm'),
(0, '2009-01-04', '1900-01-01 00:00:00', NULL),
(8, '2008-04-03', '2005-01-01 11:55:18', 'q'),
(8, NULL, '2005-02-28 03:44:02', 'w'),
(0, '2003-08-22', NULL, 'c'),
(9, '1900-01-01', NULL, 'y'),
(NULL, NULL, '2006-08-25 16:28:09', 'g'),
(5, '2004-07-04', '2002-08-11 00:00:00', 'z'),
(1, '1900-01-01', '2007-07-22 21:19:18', 'm'),
(2, '2007-02-04', '2006-02-10 18:41:38', 't'),
(2, '1900-01-01', '2009-02-16 14:58:58', 'd'),
(7, '2001-03-14', '2007-08-14 00:00:00', 'h'),
(0, NULL, '1900-01-01 00:00:00', NULL),
(1, '2008-10-05', NULL, 'f'),
(6, '2001-11-25', '2008-12-03 06:59:23', 'l'),
(NULL, '2003-01-27', '2008-10-04 00:00:00', 'g'),
(8, '2008-08-08', '2009-07-07 07:00:21', 'v'),
(8, '2006-07-03', '2001-04-15 00:00:00', NULL),
(5, '2002-11-21', '2007-07-08 04:01:58', 'm'),
(5, '2006-04-08', '2007-09-23 00:01:35', 'i'),
(5, '2001-05-06', '2008-05-15 00:00:00', 'h'),
(7, '1900-01-01', '1900-01-01 00:00:00', 'u'),
(30, '2007-04-16', '2004-03-05 23:35:38', 'o'),
(NULL, '1900-01-01', '2007-08-25 01:32:47', 'z'),
(6, '2004-12-03', '1900-01-01 00:00:00', 'o'),
(8, '2001-06-23', '1900-01-01 00:00:00', 'f'),
(NULL, '2008-12-15', '2001-05-19 08:28:28', 'a'),
(9, '2000-02-15', '2009-09-03 06:07:22', 'd'),
(2, '2001-08-05', '2006-10-08 07:17:27', 'k'),
(5, '2004-01-17', '2003-09-06 20:36:01', 'd'),
(4, '2003-10-01', '2001-02-05 18:10:49', 'u'),
(4, '2003-07-28', '2001-01-07 16:11:37', 'h'),
(0, '1900-01-01', '2008-08-01 05:26:38', 'w'),
(9, '1900-01-01', '2001-05-08 00:00:00', 't'),
(1, '2000-04-17', '2008-07-10 21:26:28', 'i'),
(8, '2002-01-05', '2006-08-06 20:56:35', 'k'),
(9, '2001-04-10', '2003-02-17 00:00:00', 'z'),
(0, '2009-12-04', NULL, 'h'),
(7, NULL, '2004-10-27 00:29:57', 'h'),
(2, '2006-03-07', '2008-03-04 06:14:13', 'b'),
(0, '2001-10-15', '2001-03-17 00:00:00', 'm'),
(5, '1900-01-01', '2009-02-21 11:35:50', 'i'),
(4, NULL, '1900-01-01 00:00:00', 'w'),
(5, '2009-04-05', '1900-01-01 00:00:00', 'm'),
(6, '2001-03-19', '2001-04-12 00:00:00', 'q'),
(NULL, '2009-12-08', '2001-12-04 20:21:01', 'k'),
(2, '2005-02-09', '2001-05-27 08:41:01', 'l'),
(9, '2004-05-25', '2004-09-18 00:00:00', 'c'),
(3, '2005-01-17', '2002-09-12 11:18:48', 'd'),
(0, '2003-08-28', '1900-01-01 00:00:00', 'k'),
(6, '2006-10-11', '2003-10-28 03:31:02', 'a'),
(5, '1900-01-01', '2001-08-22 10:20:09', 'p'),
(8, '1900-01-01', '2008-04-24 00:00:00', 'o'),
(4, '2005-08-18', '2006-11-10 10:08:49', 'e'),
(NULL, '2007-03-12', '2007-10-16 00:00:00', 'n'),
(1, '2000-11-18', '2009-05-27 12:25:07', 't'),
(4, '2001-03-03', NULL, 'u'),
(3, '2003-09-11', '2001-09-10 18:10:10', 'f'),
(4, '2007-06-17', '1900-01-01 00:00:00', 't'),
(NULL, '2008-09-11', '2004-06-07 23:17:09', 'k');
ALTER TABLE t1 ADD UNIQUE KEY ind1 (pk, d, i, v);
--error ER_DUP_ENTRY
ALTER TABLE t1 ADD UNIQUE KEY ind2 (d, v);
DROP TABLE t1;
...@@ -1433,6 +1433,7 @@ int ha_myisam::enable_indexes(uint mode) ...@@ -1433,6 +1433,7 @@ int ha_myisam::enable_indexes(uint mode)
else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE) else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
{ {
THD *thd= table->in_use; THD *thd= table->in_use;
int was_error= thd->is_error();
HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param)); HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
const char *save_proc_info=thd->proc_info; const char *save_proc_info=thd->proc_info;
...@@ -1475,7 +1476,7 @@ int ha_myisam::enable_indexes(uint mode) ...@@ -1475,7 +1476,7 @@ int ha_myisam::enable_indexes(uint mode)
might have been set by the first repair. They can still be seen might have been set by the first repair. They can still be seen
with SHOW WARNINGS then. with SHOW WARNINGS then.
*/ */
if (! error) if (! error && ! was_error)
thd->clear_error(); thd->clear_error();
} }
info(HA_STATUS_CONST); info(HA_STATUS_CONST);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment