Bug #26 point(subselect(...)..)

Submitted: 8 Jan 2003 16:59 Modified: 16 Dec 2003 1:48
Reporter: Alexey Botchkov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:4.1 OS:
Assigned to: Alexey Botchkov CPU Architecture:Any

[8 Jan 2003 16:59] Alexey Botchkov
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 )
     {
[8 Jan 2003 17:00] MySQL Developer
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/

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.