Technology Errors

Zen Cart New Product Error: 1062 Duplicate entry ‘2147483647’ for key ‘PRIMARY’

A client of mine contacted me earlier because he was unable to add products to his Zen Cart store. I recently installed a couple modules for him and was thinking that the issue may be related to one of the modules however this did not end up being the case. After some investigation I was able to resolve the problem easily by first deleting a product that had been added and then by issuing a SQL command to modify the auto increment numbers for the Zen Cart products table. Below there is more information on the error as well as details on how to resolve the issue.

Technology Insights

PostgreSQL: PSQL Select Distinct Output * To Generate New Table

Earlier this evening I ran into a unique issue where a PostgreSQL table had been created with no primary key this allowing duplicate rows to exist in the database table. You are unable to delete such rows in a SQL table because there is no primary key. After not being able to delete the rows via the PSQL CLI I opened pgAdmin III to see if I could delete the rows using the GUI interface provided by pgAdmin III however the delete was grey in the menu as shown in the below image.