I'm getting this error when I click on Validate button on "Vendor Bill" form:
Constraint error
I know for sure that the invoice number is unique. I even tried to create a completely new vendor bill with different vendor and I still get the same error.
It used to be fine, but for some reason it's throwing an error now. I want to try to restore my db before it started happening, but I'm not sure it'll help.
Any thoughts on why it's happening and how it can be fixed?
I agree your question is not related to programming. But nonetheless, this is probably caused by the fact that you have demo data on your database. Demo data will create validated invoices with valid numbers while the sequence number is still at one. At some point the values will overlap.
Just create a database without demo values and you should get rid of your problem.
I need to add records to a table which has a unique id field. Up until recently I did this via a query but find today it doesn't work.
I tried manually copying a record and I tried manually inputting a new record. In both cases Access created a record with id=1306 but the next id would have been 1899. Consequently there was an error msg = The changes you made were not successful because they would create duplicate id...
Every time I go through this process the trial id clocks on 1 and is now 1309.
I am prevented from editing this manually. The table is related to many other tables and vice versa.
Any ideas please.
The table was created under Access 2003 or earlier. The edition running now is 2013.
Thanks - Stewart.
Fixed by running Repair & Compact.
Wrong/duplicate generated Autonumbers are a sign that something is broken in the database.
Further reading:
Allen Browne: Fixing AutoNumbers when Access assigns negatives or duplicates
Using Magento 1.6
I had to make some bulk changes to my catlog and so did a full product export, made the changes then imported the ammended file.
Afterwards there were a few index that needed updating, all of them except the "Product Attributes" index correctly.
When I try to re index that one I get the error "There was a problem with reindexing process."
There are no new errors created in var/report and so I have no idea what the problem is.
csv -> http://lazytrek.com/magento_export.csv
edit - As per OSdave's suggestion I got the following error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '84-142-1-58' for key 'PRIMARY'
After struggling for hours I finally found a solution. In fact, It's a very simple solution:
Backup your database
Open phpMyAdmin and truncate (empty) the table catalog_product_flat_1
That's it. After that I was able to index all data and, until now, everything else works perfectly. This worked for me. I hope it works for you too.
PS: using Magento 1.6.0.0
OK I fixed this myself
In the SQL error the first number (in my case 84) indicates the product id, something did not import properly with that ID, I went into the product, saved it manually and hey presto I could re-index.
Hope that helps someone :-)
Remove the lock files in var/locks and try again.
I'd advise you reindex in SSH if you have a large data set
php shell/indexer.php -reindexall
Source :: https://magento.stackexchange.com/questions/24729/there-was-a-problem-with-reindexing-process
I also had this issue and was getting the following in my exception log:
Integrity constraint violation: 1062 Duplicate entry '706-168-2-60' for key 'PRIMARY''
Eventually I discovered (as posted above) that this was a problem with product ID 706 (the first digits before '-' are the product ID.
Simply opening this product within the Magento admin and saving it fixed the issue with this product, however, in my case I also had a problem with product 707, 708, 709, etc, etc...
What I then discovered is the second set of digits identify the attribute ID. I figured out which attribute this was by opening any attribute and replacing it's ID in the URL with the one in the exception log.
I then searched for a series of products (in my case 700 to 800), selected them all and used "Actions" "Update attributes" in the top right of the Catalog - Manage Products page.
I amended this attribute for all of them (which was fine for me) and the indexer worked.
If you can't set this attribute to be the same for all your products I'd suggest a bulk import to reset just this.
Last night, I was having the same problem. After following the steps outlined by OSdave to get the more precise error message, I saw my error was the same as yours.
But it wasn't just with 1 product there were several hundred products causing errors (each one saved brought up a new one). And it wasn't all with the same attribute (I'd updated multiple attributes across a database of over 4,000 products in my last import).
Since everything seemed to actually be in the database correctly (since re-saving seemed to be fixing it and giving the proper data to the final saved product), I had an idea.
Why not export all 4k products, and then re-import the same file without modification and see if that clears it.
It worked!
tl;dr: If you're having this problem with multiple products needing to be re-saved, export your whole inventory (or the relevant section if you can segment in a useful way), and re-import the same file with no modifications.
I'm using Magento v 1.9.0.1
Thanks OSdave,
It's same error for me, I changed this
in Mage_Index_Adminhtml_ProcessController edit line 138, from Mage::helper('index')->__('Cannot initialize the indexer process.') to $e->getMessage():
then tried re-index, it's shows the below error
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '8308-2018-1-2788' for key 'PRIMARY', query was: INSERT INTO catalog_product_index_eav_idx (entity_id,attribute_id,store_id,value
then, I remove the product with ID '8308' and recreated and after tried to re-index, it working fine.
But don't the exact root cause of issue. I hope it's help to someone!
Double check the catalog_product_entity,catalog_product_entity_datetime,catalog_product_decimal,catalog_product_int, catalog_product_text,catalog_product_varchar table columns have with respective UNIQUE KEY's.
All this afte rupgrading from 1.4.1
I get a quite specific error message:
Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'product/19-1-2' for key 'UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID'' in /home/in-due/domains/sb2.in-due.de/public_html/hochzeitsshop/lib/Zend/Db/Statement/Pdo.php:234
problem is, that I don't know how to find the entry, that is making trouble. neither in the backend (catalog|URL Rewrite Management) nor in the db itself (table core_url_rewrite) is an entry
product/19-1-2
any help is appreciated,
PAT ERLER
#perler, here is a MySQL query to detect duplicate SKUs. Remember, if you prefixed your tables, change catalog_product_entity accordingly!
SELECT
DISTINCT(`sku`) as `sku`,
COUNT(`sku`) as `skuCount`,
entity_id
FROM
catalog_product_entity
GROUP BY
`sku`
HAVING
`skuCount` > 1;
The duplicate entry is for a key made up from 3 fields, id_path, is_system and store_id, in theory you should be able to use URL Rewrite Management, search for an id_path of product/19 and this is your 'troublesome' field. Deleting that value may solve the issue (but I'd recommend making a backup first, and trying it in a dev environment first).
If you are still in development and haven't used any custom rewrites you could just empty the core_url_rewrite table and re-index to regenerate all the fields. If it is a live site this would be a little more troublesome, it would mean losing a bit of SEO juice if you have renamed products, since you would lose the rewrite.
Ok, the problem was a duplicate SKU. You shouldn't be able to enter one, but what happened (in magento 1.4.0.1) was, that the client entered a very long SKU which got shortened when saving the product. the shortened part was then identically to another SKU.
so, if yourself have this problem, check you database for duplicate SKUs (can someone post an SQL Query to do this?)
EDIT:
It appears that under some circumstances (which I have yet to determine) the reserved_id field is not being reset/cleared for some customers. Therefore, when a very small percentage of customers log in after performing a successful transaction their quote_id is being assigned the value of that in the sales_flat_quote table.
Therefore when they try to place the order we are seeing integrity constraint violation errors in the logs - such as:
"SQLSTATE[23000]: Integrity constraint violation 1062 Duplicate entry "
This is beginning to look like a core bug but Its completely un-reproducible at the moment.
Magento version 1.5.0.1
Have you tried the database repair tool? It can be found at http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool. It seems like yo need to repair your database.