Bug #530

Plantage des requêtes sous mysql 5 en mode strict (win)

Added by jmd about 15 years ago. Updated almost 15 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:moyo% Done:

0%

Category:Common
Target version:0.68

Description

Extrait du forum :
J'ai fait un installation de base (sans mise à jour) de GLPI 0.65 et j'ai constaté que l'on pouvait ajouter des équipements dans la partie inventaire sans problème.

Si on modifie un équipement ou un gabarits et :

- Qu'on y ajoute des information dans un champs jusque là vide, pas de problème la mise à jorus sera effectuée

- Qu'on modifie des données dans un champs contenant déjà des données on se retrouve avec l'erreur suivante :

Out of range value adjusted for column 'ID' at row 1

History

#1 Updated by jmd about 15 years ago

Solution immédiate : 

This is a wide spread problem in New [[MySQL]] 5.0 installs. I solved it by opening the file 'my.ini' in your [[MySQL]] install folder - the config file. And commenting out the command near the top that turns on the 'strict' mode.

#2 Updated by jmd about 15 years ago

Solution technique et explication : The error is actually to do with the STRICT SQL Mode. With the above INSERT statement you are trying to insert an empty string (_) to rely on the AUTO_INCREMENT'ed value to be replaced. The STRICT SQL Mode does not allow data conversions to take place like that (where earlier versions were a little more lax).

Another solution is to use NULL instead of _ for your AUTO_INCREMENT column.

mysql> CREATE TABLE t1 (x INT AUTO_INCREMENT PRIMARY KEY,
   ->    y CHAR(1));
Query OK, 0 rows affected (0.10 sec)

mysql> INSERT INTO t1 VALUES (_,'A');
ERROR 1264 (22003): Out of range value adjusted for column 'x' at row 1
mysql> SELECT * FROM t1;
Empty set (0.00 sec)

mysql> INSERT INTO t1 VALUES (NULL, 'A');
Query OK, 1 row affected (0.03 sec)

mysql> SELECT * FROM t1;
+---+------+
| x | y    |
+---+------+
| 1 | A    |
+---+------+
1 row in set (0.00 sec)

#3 Updated by moyo almost 15 years ago

  • Status changed from New to Closed

Also available in: Atom PDF