-
Notifications
You must be signed in to change notification settings - Fork 9
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
Duplicate entry when trying to add product with two level category neither existing #67
Comments
Just created a new database. Same issue. |
Entering some notes here to potentially further support what has been found to be a mySQL 8.x "feature". I had looked at this issue upon notification and had begun making changes to resolve; however, don't recall having found the below. First, yes I agree retrieving the As far as other notes, the implementation uses data that gets cached and therefore not updated as expected. This is discussed here: https://stackoverflow.com/questions/52705477/mysql-show-table-status-auto-increment-is-not-correct Considering resetting Another thought to the two or three you had would be to do the insert without In my recent/previous testing, just returning to always checking for the max |
A change to default settings in mySQL 8.x that are not always able to be overridden by an end user causes database table configured data to remain cached for an extended period. As a result, attempts to insert new categories were failing because the category id already existed. Historically category addition was done based on the highest value retrieved from the database which may not reflect the highest value ever used. Further, the value needs to be dynamic as other users may be adding a category at the same time and cause some sort of clash if not handled in the correct sequence. Now though, this insert will fail if the categories table has lost its auto_increment condition (which was not a problem per se with previous methods of determination). Fixes #67
Zen cart 1.5.8
Apache/2.4.41 (Ubuntu)
Database client version: libmysql - mysqlnd 8.0.20
PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation
PHP version: 8.0.20
Database Server version: 8.0.29-0ubuntu0.20.04.3 - (Ubuntu)
Trying to add new product with new two tier product categories.
"Ty Rhos Jewellery^Pendants"
the first category "Ty Rhos Jewellery" is added. The second category fails with duplicate entry
log file
the categories table has Next autoindex =65
This was used for the first category.
The issue appears to be that the Autoindex does not get incremented if you supply the index key.
Not sure if this is an issue with mysql.
I get a similar issue if I add two products having created the categories first.
for categories easypopulate_4_import.php 1087-1103
Could either add in check for max value
"SELECT max(categories_id) AS max_id FROM " . TABLE_CATEGORIES
and compare with $max_category_id and use the biggest.
Or
remove the categories_id from the insert and get the insert id from the insert query.
$current_category_id = ($ep_uses_mysqli ? mysqli_insert_id($db->link) : mysql_insert_id());
I don't know if this is an issue with my database? If it is, I don't know how to solve it.
The database was created using the default data from zc_install.
The text was updated successfully, but these errors were encountered: