Bug #39737 Assignment operator does not allocate memory for spatial variables
| Submitted: | 29 Sep 2008 20:09 | Modified: | 10 Jul 2009 8:46 |
|---|---|---|---|
| Reporter: | N Kumar | Email Updates: | |
| Status: | Patch approved | Impact on me: | |
| Category: | MySQL Server: Data Types | Severity: | S1 (Critical) |
| Version: | 5.1.28 | OS: | Windows |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
| Tags: | spatial | ||
[30 Sep 2008 15:30]
Valeriy Kravchuk
Verified with 5.1.28:
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uroot -proot -P3310 test
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.28-rc-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> drop procedure test;
ERROR 1305 (42000): PROCEDURE test.test does not exist
mysql> DELIMITER $$
mysql> CREATE PROCEDURE TEST()
-> BEGIN
-> DECLARE P1, P2 POINT;
->
-> SET P1 = GeomFromText('POINT( 10 10)');
-> SET P2 = P1;
-> SELECT ' Both P1 and P2 should be identical:', ASTEXT(P1), ASTEXT
(P2);
->
-> SET P1 = GeomFromText('POINT( 20 20)');
->
-> SELECT 'P1 and P2 should differ', ASTEXT(P1), ASTEXT(P2);
-> END;
-> $$
Query OK, 0 rows affected (0.30 sec)
mysql> DELIMITER ;
mysql> CALL TEST();
+--------------------------------------+--------------+--------------+
| Both P1 and P2 should be identical: | ASTEXT(P1) | ASTEXT(P2) |
+--------------------------------------+--------------+--------------+
| Both P1 and P2 should be identical: | POINT(10 10) | POINT(10 10) |
+--------------------------------------+--------------+--------------+
1 row in set (0.06 sec)
+-------------------------+--------------+--------------+
| P1 and P2 should differ | ASTEXT(P1) | ASTEXT(P2) |
+-------------------------+--------------+--------------+
| P1 and P2 should differ | POINT(20 20) | POINT(20 20) |
+-------------------------+--------------+--------------+
1 row in set (0.08 sec)
Query OK, 0 rows affected (0.08 sec)
[13 Apr 2009 13:56]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/71929 2870 Alexey Botchkov 2009-04-13 Bug#39737 Assignment operator does not allocate memory for spatial variables GEOMETRY fields should be handled like blobs when they're copied. per-file messages: mysql-test/r/gis.result Bug#39737 Assignment operator does not allocate memory for spatial variables test result mysql-test/t/gis.test Bug#39737 Assignment operator does not allocate memory for spatial variables test case sql/field_conv.cc Bug#39737 Assignment operator does not allocate memory for spatial variables to->type() == MYSQL_TYPE_GEOMETRY checks added
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.043 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: for example, lets say g1 & g2 are of type GEOMETRY. then set g1 = g2 does not allocate new memory to g1 & copy the value of g2. instead it points to the value at g1 How to repeat: DELIMITER $$ CREATE PROCEDURE TEST() BEGIN DECLARE P1, P2 POINT; SET P1 = GeomFromText('POINT( 10 10)'); SET P2 = P1; SELECT ' Both P1 and P2 should be identical:', ASTEXT(P1), ASTEXT(P2); SET P1 = GeomFromText('POINT( 20 20)'); SELECT 'P1 and P2 should differ', ASTEXT(P1), ASTEXT(P2); END; $$ DELIMITER ; CALL TEST(); Suggested fix: I think assignment operator should alloc new memory to LHS variable