simple insert in empty table doesn't fail but doesn't insert
CLIENT:
python 3.1.1 + mysql connector 0.1.3
Linux pixel 2.6.31.3-nogo-pixel #1 SMP PREEMPT Mon Dec 7 01:14:18 EST 2009 i686 Intel(R) Core(TM)2 CPU U7600 @ 1.20GHz GenuineIntel GNU/Linux
SERVER:
Server version: 5.1.39-
Linux oneohone 2.6.18-6-amd64 #1 SMP Fri Dec 12 05:49:32 UTC 2008 x86_64 GNU/Linux
COMMAND:
MySQLCursor.
Debug from within cursor.py:
cursor.
cursor.
cursor.
cursor.
cursor.
cursor.
As I mentioned in the summary: It is an empty table (below you will find the show create table).
After several trials I then copied and pasted the "_executed" string in the mysql client on the server and here is what I saw:
+ at the beginning the table was still empty!
+ then I tried the _execute string (in the mysql client) and selected and got an ID of 12 !!?? (.. and I did not use the table in any other way --> I guess the "insert trials" from python did increase the ID (without inserting anything))
+ then I ran the python program again 3 times
+ then I "DELETE"d (in the mysql client)
+ and ran the "INSERT" again (in the mysql client) and got an ID of 16
Why is this not working? Am I missing something?!
Any help very appreciated.
Please let me know if you need any further information.
mysql> use user;
Database changed
mysql> select * from users;
Empty set (0.00 sec)
mysql> INSERT INTO users (`username`) VALUES ('SYSTEM') ON DUPLICATE KEY UPDATE `username`
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> select * from users;
+----+-
| ID | username | password | creation |
+----+-
| 12 | SYSTEM | | NULL |
+----+-
1 row in set (0.00 sec)
mysql> delete from users where username = 'SYSTEM';
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO users (`username`) VALUES ('SYSTEM') ON DUPLICATE KEY UPDATE `username`
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> select * from users;
+----+-
| ID | username | password | creation |
+----+-
| 16 | SYSTEM | | NULL |
+----+-
1 row in set (0.00 sec)
mysql> show create table users;
+------
| Table | Create Table |
+------
| users | CREATE TABLE `users` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` char(128) COLLATE utf8_unicode_ci NOT NULL,
`password` char(128) COLLATE utf8_unicode_ci NOT NULL,
`creation` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `ID_UNIQUE` (`ID`)
) ENGINE=ndbcluster AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=
+------
1 row in set (0.00 sec)
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- Geert JM Vanderkelen Edit question
- Solved by:
- Geert JM Vanderkelen
- Solved:
- Last query:
- Last reply:
This question was originally filed as bug #518487.