Today I'm discovered strange behavior of SQL query
UPDATE tablename SET value=value+const WHERE ...
UPDATE tablename SET value=value-const WHERE ...
UPDATE tablename SET value=value*const WHERE ...
UPDATE tablename SET value=value/const WHERE ...

I have incorrect results of this queries only in Red Hat Linux 7.2+mysql
3.22.32

On Red Hat 6.2+mysql 3.22.32 or Red Hat 7.2+mysql 3.23.44 all work fine.

---cut---
[root@rh72]# rpm -qa | grep mysql
mysql-server-3.23.44-1
mysql-devel-3.23.44-1
mysql-3.23.44-1

[root@rh72]# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 3.23.44

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use donlink
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> CREATE TABLE test(val1 bigint(10),val2 double( 5,3));
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM test;
Empty set (0.00 sec)

mysql> INSERT INTO test VALUES(1,2);
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM test;
+------+-------+
| val1 | val2  |
+------+-------+
|    1 | 2.000 |
+------+-------+
1 row in set (0.00 sec)

mysql> UPDATE test SET val1=val1+1, val2=val2+2;
Query OK, 1 row affected (0.00 sec)
Соответствующих записей: 1  Изменено: 1  Предупреждений: 0

mysql> SELECT * FROM test;
+------+-------+
| val1 | val2  |
+------+-------+
|    2 | 4.000 |
+------+-------+
1 row in set (0.00 sec)

mysql> UPDATE test SET val1=val1*2, val2=val2*2;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM test;
+------+-------+
| val1 | val2  |
+------+-------+
|    4 | 8.000 |
+------+-------+
1 row in set (0.00 sec)

mysql> quit
Bye
[root@rh72]# /etc/rc.d/init.d/mysqld stop
Останавливается MySQL:                                     [  ОК  ]
[root@rh72]# rm -rf /var/lib/mysql/donlink/test.*
[root@rh72]# rpm -e mysql mysql-server mysql-devel
[root@rh72]# rpm -ivh /usr/src/redhat/RPMS/i686/mysql-3.22.32-1.i686.rpm 
/usr/src/redhat/RPMS/i686/mysql-devel-3.22.32-1.i686.rpm 
/usr/src/redhat/RPMS/i686/mysql-server-3.22.32-1.i686.rpm
Подготовка...
                   ########################################### [100%]
    1:mysql        ########################################### [ 33%]
    2:mysql-devel  ########################################### [ 66%]
    3:mysql-server ########################################### [100%]
[root@warp i686]# /etc/rc.d/init.d/mysqld start
Запускается MySQL:                                         [  ОК  ]

[root@rh72]# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.22.32-log

Type 'help' for help.

mysql> use donlink
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> CREATE TABLE test(val1 bigint(10),val2 double( 5,3));
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO test VALUES(1,2);
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM test;
+------+-------+
| val1 | val2  |
+------+-------+
|    1 | 2.000 |
+------+-------+
1 row in set (0.00 sec)

mysql> UPDATE test SET val1=val1+1, val2=val2+2;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM test;
+------+-------+
| val1 | val2  |
+------+-------+
|    2 | 2.000 |
+------+-------+
1 row in set (0.00 sec)

mysql> UPDATE test SET val1=val1*2, val2=val2*2;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM test;
+------+-------+
| val1 | val2  |
+------+-------+
|    4 | 0.000 |
+------+-------+
1 row in set (0.00 sec)

mysql> QUIT
Bye
---cut---

To reporoduce my problem, first oof all you must download my mysql.spec 
files

http://www.phone.dn.ua/pub/mysql-3.22.32-spec.tar.gz (6k) and 
http://www.phone.dn.ua/pub/mysql-3.23.44-spec.tar.gz (6k)

and make rpm with target i686 arch.

Thanks for your help!



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to