MySQL Forums
Forum List  »  Quality Assurance

on duplicate key update error
Posted by: Jakub Wisniewski
Date: August 22, 2007 01:45PM

Hello,

One of my clients has just mailed me about a bug which has occurred in an application I wrote some time ago.

After some tracking I finally got to the table:

> CREATE TABLE `devel_travel_miasta` (
> `id_town` int(10) unsigned NOT NULL auto_increment,
> `name` varchar(64) collate utf8_polish_ci NOT NULL,
> `confirmed` tinyint(1) unsigned NOT NULL default '0',
> PRIMARY KEY (`id_town`),
> UNIQUE KEY `unique` (`name`)
> ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=1065;

and the query

> INSERT INTO '.TAB_TRAVEL_MIASTA.' (name) VALUES ("'.$name.'") ON DUPLICATE KEY UPDATE name = "'.$name.'";

which on the 5.0.45-log server after invoking mysql_insert_id(); returns "next autoindex" value instead of the ID value of the updated row.

The code used to work fine till today on the remote (probably just upgraded) server, and works fine on my local 5.0.27-community-nt server.

Any clue what's going on?

Regards,

Jakub Wiƛniewski
Custom Internet Solutions
http://jrobin.net/en

Options: ReplyQuote


Subject
Views
Written By
Posted
on duplicate key update error
5921
August 22, 2007 01:45PM
2715
x x
September 02, 2007 01:16PM


Sorry, you can't reply to this topic. It has been closed.

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.