Skip to content

Commit 0dd5eaa

Browse files
author
Satya B
committed
Applying InnoDB snapshot 5.0-ss6230, Part 1. Fixes BUG#47777
BUG#47777 - innodb dies with spatial pk: Failing assertion: buf <= original_buf + buf_len Detailed revision comments: r6178 | jyang | 2009-11-17 08:52:11 +0200 (Tue, 17 Nov 2009) | 6 lines branches/5.0: Merge fix for bug #47777 from branches/5.1 -r6045 to bracnches/5.0. Treat the Geometry data same as Binary BLOB in ha_innobase::store_key_val_for_row(), since the Geometry data is stored as Binary BLOB in Innodb.
1 parent 531d32a commit 0dd5eaa

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

mysql-test/r/innodb_bug47777.result

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
2+
insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
3+
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
4+
count(*)
5+
1
6+
update bug47777 set c2=GeomFromText('POINT(1 1)');
7+
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
8+
count(*)
9+
0
10+
select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
11+
count(*)
12+
1
13+
drop table bug47777;

mysql-test/t/innodb_bug47777.test

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This is the test for bug 47777. GEOMETRY
2+
# data is treated as BLOB data in innodb.
3+
# Consequently, its key value generation/storing
4+
# should follow the process for the BLOB
5+
# datatype as well.
6+
7+
--source include/have_innodb.inc
8+
9+
create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
10+
11+
insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
12+
13+
# Verify correct row get inserted.
14+
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
15+
16+
# Update table bug47777 should be successful.
17+
update bug47777 set c2=GeomFromText('POINT(1 1)');
18+
19+
# Verify the row get updated successfully. The original
20+
# c2 value should be changed to GeomFromText('POINT(1 1)').
21+
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
22+
select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
23+
24+
drop table bug47777;

sql/ha_innodb.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2767,7 +2767,10 @@ ha_innobase::store_key_val_for_row(
27672767
} else if (mysql_type == FIELD_TYPE_TINY_BLOB
27682768
|| mysql_type == FIELD_TYPE_MEDIUM_BLOB
27692769
|| mysql_type == FIELD_TYPE_BLOB
2770-
|| mysql_type == FIELD_TYPE_LONG_BLOB) {
2770+
|| mysql_type == FIELD_TYPE_LONG_BLOB
2771+
/* MYSQL_TYPE_GEOMETRY data is treated
2772+
as BLOB data in innodb. */
2773+
|| mysql_type == FIELD_TYPE_GEOMETRY) {
27712774

27722775
CHARSET_INFO* cs;
27732776
ulint key_len;

0 commit comments

Comments
 (0)