DBD::mysql::st execute failed: Duplicate entry '127' for key 1

Discussion in 'Perl Misc' started by mike, Apr 22, 2005.

  1. mike

    mike Guest

    My autoincrement is stuck on entry 127.

    My script tried to insert a new record and I got this entry

    "DBD::mysql::st execute failed: Duplicate entry '127' for key 1 "

    Yes id 127 aready exists. When 127 was created the pointer should have
    moved to 128, but it didn't.

    How do I change the autoincrement pointer in MySQL?

    Mike
    mike, Apr 22, 2005
    #1
    1. Advertising

  2. mike

    Guest

    "mike" <> wrote:
    > My autoincrement is stuck on entry 127.
    >
    > My script tried to insert a new record and I got this entry
    >
    > "DBD::mysql::st execute failed: Duplicate entry '127' for key 1 "


    Do you have a Perl question?

    >
    > Yes id 127 aready exists. When 127 was created the pointer should have
    > moved to 128, but it didn't.


    Are you explicitly setting the field value to 127 but expecting MySQL to
    override it with 128 anyway? If so, don't do that.

    > How do I change the autoincrement pointer in MySQL?


    I don't know, but it would help if you would:
    1) Include the actual thing that is causing the error.
    2) Post it to the right group.


    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    , Apr 22, 2005
    #2
    1. Advertising

  3. mike

    mike Guest

    Yes I posted it in: perl.dbi.users, but I didn't get a response there.

    My auto_incrementer is not working. I manually deleted record 127 and
    did a re-insert, it got 127 like it should, but did not set the pointer
    to 128.
    mike, Apr 22, 2005
    #3
  4. mike

    J. Gleixner Guest

    Re: DBD::mysql::st execute failed: Duplicate entry '127' for key1

    mike wrote:
    > Yes I posted it in: perl.dbi.users, but I didn't get a response there.
    >
    > My auto_incrementer is not working. I manually deleted record 127 and
    > did a re-insert, it got 127 like it should, but did not set the pointer
    > to 128.


    Your question is about MySQL, not perl.

    I'd guess that your column is a 'tinyint' and it needs to be bigger.
    J. Gleixner, Apr 22, 2005
    #4
  5. mike

    mike Guest

    Again. I got no response there ....

    Yes it is defined like:

    post_id tinyint not null primary key auto_increment

    How would the field being tinyint allow 127, but not 128?
    mike, Apr 22, 2005
    #5
  6. mike

    Guest

    "mike" <> wrote:
    > Again. I got no response there ....
    >
    > Yes it is defined like:
    >
    > post_id tinyint not null primary key auto_increment
    >
    > How would the field being tinyint allow 127, but not 128?


    Because by definition, tinyint allows 127 but not 128. That is why it is
    tiny.

    http://dev.mysql.com/doc/mysql/en/numeric-types.html

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    , Apr 22, 2005
    #6
  7. mike <> wrote:

    > Again.



    What again?

    Please quote some context in followups like everyone else does!


    > I got no response there ....



    That does not magically make it into a Perl question.

    Database questions are off-topic in non-database newsgroups.

    Please do not make any more off-topic posts here.


    > Yes it is defined like:
    >
    > post_id tinyint not null primary key auto_increment
    >
    > How would the field being tinyint allow 127, but not 128?



    Ask Perl questions in the Perl newsgroup.

    Ask database questions in a database newsgroup.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Apr 22, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Randell D.

    Failed install of DBD::mysql

    Randell D., Dec 10, 2003, in forum: Perl
    Replies:
    0
    Views:
    588
    Randell D.
    Dec 10, 2003
  2. JL
    Replies:
    0
    Views:
    1,132
  3. Andrew Crook

    DBD::CSV questions and is there a DBD::XML?

    Andrew Crook, Sep 2, 2003, in forum: Perl Misc
    Replies:
    2
    Views:
    153
    Andrew Crook
    Sep 11, 2003
  4. Mike Solomon

    DBD::mysqlPP v DBD::mysql

    Mike Solomon, Feb 16, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    197
    James Willmore
    Feb 16, 2004
  5. Jim Cochrane
    Replies:
    0
    Views:
    106
    Jim Cochrane
    Aug 25, 2007
Loading...

Share This Page