[MDEV-23430] AUTO_INCREMENT column gets unexpected value after INSERT -2 Created: 2020-08-07 Updated: 2020-08-08 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 10.4.13, 10.5.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | FLAESCH Sebastien | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux Debian 10 x86_64 |
||
| Attachments: |
|
| Description |
|
After inserting negative -2 in an auto-incremented column, the new generated serial jumps from 1 to 3, when it should be 2, according to the documentation: https://mariadb.com/kb/en/auto_increment/#setting-explicit-values The doc shows examples with positive values, but there is a clear sentence:
Which should include negative explicit values ... |
| Comments |
| Comment by FLAESCH Sebastien [ 2020-08-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
To reproduce with serial.sql
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by FLAESCH Sebastien [ 2020-08-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In fact this is not dramatic: Obviously, values generated by auto-incremented columns may not be an exact numeric sequence, especially in a multi-user environment. I have reported this to alert you about the behavior change, to make sure there is not a more important defect, and to indicated that there seems to be exceptions to what the documentation describes. I wonder about the fact that there is only a gap between 1 et 3 (2 is missing), but then for next serials, there is no missing number (4,5,6)... something weird to me. This issue has been detected in one of our non-regression test programs (FOURJS Genero BDL), where only the test program inserts rows into the table. |