From 81db1e7fa2fcedf1ffc3b0e54d106fb598ad7d4d Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Sat, 15 Mar 2003 12:35:09 +0100 Subject: [PATCH 1/4] - tagged ChangeSet 1.1358 as mysql-3.23.56 - bumped up version number to 3.23.57 in configure.in --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index a8aacc6a6bf..cc6f3a79b69 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 3.23.56) +AM_INIT_AUTOMAKE(mysql, 3.23.57) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From 008e1d29a3e807f6d1c53f8d6dc44f67217e2114 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Sat, 15 Mar 2003 20:05:55 +0200 Subject: [PATCH 2/4] row0sel.c: Fix bug number 154: GROUP BY and DISTINCT could treat NULL values inequal --- innobase/row/row0sel.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index 5f260634149..c9de502eb9a 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2115,19 +2115,14 @@ row_sel_store_mysql_rec( extern_field_heap = NULL; } } else { - /* MySQL sometimes seems to copy the 'data' - pointed to by a BLOB field even if the field - has been marked to contain the SQL NULL value. - This caused seg faults reported by two users. - Set the BLOB length to 0 and the data pointer - to NULL to avoid a seg fault. */ + /* MySQL seems to assume the field for an SQL NULL + value is set to zero. Not taking this into account + caused seg faults with NULL BLOB fields, and + bug number 154 in the MySQL bug database: GROUP BY + and DISTINCT could treat NULL values inequal. */ - if (templ->type == DATA_BLOB) { - row_sel_field_store_in_mysql_format( - mysql_rec + templ->mysql_col_offset, - templ->mysql_col_len, NULL, - 0, templ->type, templ->is_unsigned); - } + memset(mysql_rec + templ->mysql_col_offset, '\0', + templ->mysql_col_len); if (!templ->mysql_null_bit_mask) { fprintf(stderr, From 852b1b3dc5663957db3313851981e0182a0ca66c Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Sun, 16 Mar 2003 14:40:41 +0200 Subject: [PATCH 3/4] row0mysql.c: Test if merging from 3.23 to 4.0 succeeds --- innobase/row/row0mysql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index f0aa413a64c..ae2f3514f4d 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -6,7 +6,7 @@ Contains also create table and other data dictionary operations. Created 9/17/2000 Heikki Tuuri *******************************************************/ - + #include "row0mysql.h" #ifdef UNIV_NONINL From 85de222334f89a95bb60554b537d84c3bdc5a627 Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Tue, 18 Mar 2003 02:51:16 +0200 Subject: [PATCH 4/4] Fix of 'halloween bug' with UPDATE of InnoDB tables. --- mysql-test/r/innodb.result | 10 ++++++++++ mysql-test/t/innodb.test | 11 +++++++++++ sql/key.cc | 8 ++++++++ strings/strto.c | 2 ++ 4 files changed, 31 insertions(+) diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 0930e3aa5fd..06663e36007 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -501,3 +501,13 @@ table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 4 Field Type Null Key Default Extra testint int(11) 1 +a b +1 1 +102 2 +103 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index a962f120d4e..0362ec69ebf 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -537,3 +537,14 @@ drop table t1; create table t1 (testint int not null default 1) type=innodb; desc t1; drop table t1; + +# +# Check update with conflicting key +# + +CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) type=innodb; +INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +# We need the a < 1000 test here to quard against the halloween problems +UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; +SELECT * from t1; +drop table t1; diff --git a/sql/key.cc b/sql/key.cc index f2488ab74cb..9f5379487c3 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -269,5 +269,13 @@ bool check_if_key_used(TABLE *table, uint idx, List &fields) return 1; } } + + /* + If table handler has primary key as part of the index, check that primary + key is not updated + */ + if (idx != table->primary_key && table->primary_key < MAX_KEY && + (table->file->option_flag() & HA_PRIMARY_KEY_IN_READ_INDEX)) + return check_if_key_used(table, table->primary_key, fields); return 0; } diff --git a/strings/strto.c b/strings/strto.c index d3392c794e9..54ff2214f60 100644 --- a/strings/strto.c +++ b/strings/strto.c @@ -36,6 +36,8 @@ it can be compiled with the UNSIGNED and/or LONGLONG flag set */ +#define strtoll glob_strtoll /* Fix for True64 */ + #include #include "m_string.h" #include "m_ctype.h"