Bug #26 point(subselect(...)..)
Description:
mysql> insert into a (a) values (point(1, (select a from b)));
ERROR 2013: Lost connection to MySQL server during query
How to repeat:
mysql> drop table a;
Query OK, 0 rows affected (0.00 sec)
mysql> create table a (a blob, spatial key(a));
Query OK, 0 rows affected (0.00 sec)
mysql> create table b (a int);
Query OK, 0 rows affected (0.01 sec)
mysql> insert into b values (1);
Query OK, 1 row affected (0.03 sec)
mysql> insert into a (a) values (point(1,1));
Query OK, 1 row affected (0.02 sec)
mysql> insert into a (a) values (point(1, (select a from b)));
ERROR 2013: Lost connection to MySQL server during query
Suggested fix:
Here is the patch
--- 1.78/sql/item_strfunc.cc Thu Jan 2 19:03:58 2003
+++ 1.79/sql/item_strfunc.cc Wed Jan 8 19:41:38 2003
@@ -2666,6 +2666,9 @@
String *Item_func_point::val_str(String *str)
{
+ double x= args[0]->val();
+ double y= args[1]->val();
+
if ( (null_value = (args[0]->null_value ||
args[1]->null_value ||
str->realloc(1+4+8+8))))
@@ -2674,8 +2677,8 @@
str->length(0);
str->q_append((char)Geometry::wkbNDR);
str->q_append((uint32)Geometry::wkbPoint);
- str->q_append((double)args[0]->val());
- str->q_append((double)args[1]->val());
+ str->q_append(x);
+ str->q_append(y);
return str;
}
@@ -2707,10 +2710,9 @@
for (i = 0; i < arg_count; ++i)
{
+ String *res = args[i]->val_str(&arg_value);
if (args[i]->null_value)
goto ret;
-
- String *res = args[i]->val_str(&arg_value);
if ( coll_type == Geometry::wkbGeometryCollection )
{
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: mysql> insert into a (a) values (point(1, (select a from b))); ERROR 2013: Lost connection to MySQL server during query How to repeat: mysql> drop table a; Query OK, 0 rows affected (0.00 sec) mysql> create table a (a blob, spatial key(a)); Query OK, 0 rows affected (0.00 sec) mysql> create table b (a int); Query OK, 0 rows affected (0.01 sec) mysql> insert into b values (1); Query OK, 1 row affected (0.03 sec) mysql> insert into a (a) values (point(1,1)); Query OK, 1 row affected (0.02 sec) mysql> insert into a (a) values (point(1, (select a from b))); ERROR 2013: Lost connection to MySQL server during query Suggested fix: Here is the patch --- 1.78/sql/item_strfunc.cc Thu Jan 2 19:03:58 2003 +++ 1.79/sql/item_strfunc.cc Wed Jan 8 19:41:38 2003 @@ -2666,6 +2666,9 @@ String *Item_func_point::val_str(String *str) { + double x= args[0]->val(); + double y= args[1]->val(); + if ( (null_value = (args[0]->null_value || args[1]->null_value || str->realloc(1+4+8+8)))) @@ -2674,8 +2677,8 @@ str->length(0); str->q_append((char)Geometry::wkbNDR); str->q_append((uint32)Geometry::wkbPoint); - str->q_append((double)args[0]->val()); - str->q_append((double)args[1]->val()); + str->q_append(x); + str->q_append(y); return str; } @@ -2707,10 +2710,9 @@ for (i = 0; i < arg_count; ++i) { + String *res = args[i]->val_str(&arg_value); if (args[i]->null_value) goto ret; - - String *res = args[i]->val_str(&arg_value); if ( coll_type == Geometry::wkbGeometryCollection ) {