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
editing a row and using 'insert as new row' uses primary key 0 #15187
Comments
|
If the primary key |
|
I can still reproduce the error.
|
|
Hey @aschuch247 can u please tell me how u changed the As I am unable to reproduce the issue OR You just dont want |
|
I can still reproduce the error.
|
|
@yashrajbothra: See the documentation at https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_value_on_zero. And actually, I want the primary key to either not be present in the created SQL statement, so that MySQL will create a new primary key and thus a new row, or that the used primary key is |
|
Thanks you @aschuch247 :) I think Hey @williamdes is it Okay if we replace |
|
Hey @yashrajbothra I think it would be okay but I need some documentation proof from MySQl and MariaDB to approve such a change Can you please do some research? |
|
"NO_AUTO_VALUE_ON_ZERO affects handling of AUTO_INCREMENT columns. Normally, you generate the next sequence number for the column by inserting either NULL or 0 into it. NO_AUTO_VALUE_ON_ZERO suppresses this behavior for 0 so that only NULL generates the next sequence number." Approved change for MySQL |
|
For MariaDB : Docs cc @williamdes |
|
Thank you! |
|
Okay then I will Open a PR soon 👍 |
Signed-off-by: Yash Bothra <yashrajbothra786@gmail.com>
Signed-off-by: Yash Bothra <yashrajbothra786@gmail.com>
Signed-off-by: Yash Bothra <yashrajbothra786@gmail.com>
Signed-off-by: William Desportes <williamdes@wdes.fr>
|
@williamdes: Is there any chance this one-line fix can be backported to phpMyAdmin 4.9 and released with any further security fix (in case such a security fix is ever required)? |


Describe the bug
If editing a row with an autoincrement primary key and using the option 'insert as new row', the new row will get the primary key 0 assigned.
To Reproduce
Steps to reproduce the behaviour:
NO_AUTO_VALUE_ON_ZERO(https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_value_on_zero).idand a stringname.edit.saveselected. Selectinsert as new row.idnow is automatically set to0.goto edit the row.Expected behaviour
My intention is to edit a row and insert it as a new row. This works if the automatically added
0to the columnidis manually removed. I expect to not have an automatically filled out0in the columnidas soon as I selectinsert as new row.Server configuration
NO_AUTO_VALUE_ON_ZEROenabledAdditional context
The SQL mode
NO_AUTO_VALUE_ON_ZEROneeds to be enabled in order to not interpret the given primary key0as a literal zero instead of an instruction to create a new primary key.The text was updated successfully, but these errors were encountered: