MySQL Forums
Forum List  »  Triggers

cluster issue c/f Insert trigger with auto_increment
Posted by: Tom Mathews
Date: October 08, 2005 10:53AM

I have a problem with ndb (cluster) 5.13, running on fedora core 3.

When I insert into a table with auto_increment column, the value is populated with 4006 (and then subsequent rows fail with a duplicate PK error).

Table is ...

DROP TABLE IF EXISTS play;
CREATE TABLE play (
playRef INTEGER NOT NULL AUTO_INCREMENT
,playName VARCHAR(40) NOT NULL
,lastUpdate DATETIME
,lastVersion INTEGER
,PRIMARY KEY (playRef) )
;
CREATE TRIGGER insertPlay BEFORE INSERT ON play FOR EACH ROW SET NEW.lastUpdate = now(), NEW.lastVersion = 1;

Then I do something like
INSERT INTO play( playRef, playName)
VALUES
(0,'a name');
Row inserted with 1 warning

SELECT * FROM play;
playRef | playName | lastUpdate | lastVersion
4006 | a name | 2005-10-08 10:45 | 1

Anyone any ideas about how to fix this, other than by dropping the trigger and working around it in code?

I found further info which may help
If I create the table without the auto_increment, and then do an alter to put it in, I get a permissions error.

Thanks

Tom

Options: ReplyQuote


Subject
Views
Written By
Posted
cluster issue c/f Insert trigger with auto_increment
2631
October 08, 2005 10:53AM


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.