Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL: Not respecting AUTO_INCREMENT when inserting new records #27

Open
maksimovic opened this issue Apr 24, 2021 · 1 comment
Open
Labels
bug Something isn't working hacktoberfest help wanted Extra attention is needed

Comments

@maksimovic
Copy link

maksimovic commented Apr 24, 2021

sqlfuzz expects a table to be completely clean, so if a table already contains some data it then fails:

2021/04/24 15:08:26 Error 1062: Duplicate entry '1' for key 'PRIMARY'

In my case, i can't have a completely empty table/database due to various constrains, but I do want to add e.g. 100k new records.

SHOW CREATE TABLE table spits out AUTO_INCREMENT=XX so XX should be the starting point instead of 1.

@maksimovic maksimovic changed the title MySQL: Not respecting AUTO_INCREMENT MySQL: Not respecting AUTO_INCREMENT when inserting new records Apr 24, 2021
@maksimovic
Copy link
Author

Just checked the target table because it was suspicious to me that I got 4 errors for duplicate PK when I set it to insert 10 records. For some reason, it tried to insert 4 rows with value 1, which exists, but it then did insert 6 new rows starting from the correct AUTO_INCREMENT, which was actually 22 (so I got 6 new rows 22-27). Pretty weird?

@PumpkinSeed PumpkinSeed added the bug Something isn't working label Apr 24, 2021
@PumpkinSeed PumpkinSeed added help wanted Extra attention is needed hacktoberfest labels Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants