sjnlabs2013 / magento-w2p

Automatically exported from code.google.com/p/magento-w2p
0 stars 0 forks source link

SQL Error #472

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Can you figure out why this is happening without looking at the DB in questiosn?

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a 
child row: a foreign key constraint fails 
(`groenev_mage1/mage_zetaprints_product_entity_fixed_price`, CONSTRAINT 
`FK_CATALOG_PRODUCT_ENTITY_FIXED_PRICE_PRODUCT_ENTITY` FOREIGN KEY 
(`entity_id`) REFERENCES `catalog_product_entity` (`en)

This is not the first time we get this type of problem, but they manage to 
resolve it themselves. It's better be in the troubleshooting section.

Original issue reported on code.google.com by zetapri...@gmail.com on 28 Feb 2011 at 10:47

GoogleCodeExporter commented 8 years ago
It seems to me that foreign key constraint is failing, in this case - product 
id seems to be missing from products table. This is as much as I can say 
without knowing more details about when and how this happened.

Original comment by jamb...@gmail.com on 1 Mar 2011 at 7:08

GoogleCodeExporter commented 8 years ago
Site access details sent via email.

We need to either fix the underlying problem if it's ours or post an FAQ 
explanation if it's theirs.

Original comment by zetapri...@gmail.com on 2 Mar 2011 at 12:41

GoogleCodeExporter commented 8 years ago
Problem is that foreign key table names are not correct.
It is easy enough to fix - just alter the foreign keys.
Problem is that this should not happen. Table names are supposed to be dynamic 
and correct.
I will make a new local installation with table prefixes and install FQ to see 
what goes wrong.
I have fixed customer's site, hope that is ok with you.
We need a site with table prefixes on DEV too.

Original comment by jamb...@gmail.com on 2 Mar 2011 at 7:31

GoogleCodeExporter commented 8 years ago
I just made an installation and all went fine on prefixed tables database. But 
on that customer's server it is not working properly. It might be a cache 
problem of some sort.

Original comment by jamb...@gmail.com on 2 Mar 2011 at 8:39

GoogleCodeExporter commented 8 years ago
If we setup prefixed site on DEV, Atanas will be able to test this.

Original comment by jamb...@gmail.com on 2 Mar 2011 at 8:40

GoogleCodeExporter commented 8 years ago
Please, make an meaningful explanation for FAQ.
We'll post it on magehelp when ready.

**************************************

-- Integrity constraint violation: Cannot add or update a child row --

You may get the following error message:
... insert error msg, obfuscate paths/names

The error happens because ... 

Do ... to fix the problem. Other things to watch out for are .... 

Original comment by zetapri...@gmail.com on 2 Mar 2011 at 10:44

GoogleCodeExporter commented 8 years ago
You may get the following error message:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a 
child row: a foreign key constraint fails 
(`databasename/prefix_zetaprints_product_entity_fixed_price`, CONSTRAINT 
`FK_CATALOG_PRODUCT_ENTITY_FIXED_PRICE_PRODUCT_ENTITY` FOREIGN KEY 
(`entity_id`) REFERENCES `catalog_product_entity` (`en)
If you have installed any of the early alpha versions of the extension, where 
table names were hard coded. Message means that a foreign key to 
catalog/product_entity table fails. 
That is because you have used a prefix_ for your DB tables. So instead of 
catalog_product_entity table you have prefix_catalog_product_entity.

To fix the problem, you can un install the extension and make sure that the 
table created for it is deleted too. Then install again more recent version.
Alternative is if you have phpMyAdmin or any other means of accessing your DB 
server to alter prefix_zetaprints_product_entity_fixed_price table and change 
to foreign key. To do so - execute:

ALTER TABLE `prefix_zetaprints_product_entity_fixed_price` DROP FOREIGN KEY 
`FK_CATALOG_PRODUCT_ENTITY_FIXED_PRICE_PRODUCT_ENTITY`;
ALTER TABLE `prefix_zetaprints_product_entity_fixed_price` ADD FOREIGN KEY ( 
`entity_id` ) REFERENCES `prefix_catalog_product_entity` (`entity_id`) ON 
DELETE CASCADE ON UPDATE CASCADE ;
ALTER TABLE `prefix_zetaprints_product_entity_fixed_price` DROP FOREIGN KEY 
`FK_CATALOG_PRODUCT_FIXED_WEBSITE` ;
ALTER TABLE `prefix_zetaprints_product_entity_fixed_price` ADD FOREIGN KEY ( 
`website_id` ) REFERENCES `prefix_core_website` (`website_id`) ON DELETE 
CASCADE ON UPDATE CASCADE ;

Original comment by jamb...@gmail.com on 3 Mar 2011 at 9:32

GoogleCodeExporter commented 8 years ago
Buggy code fixed in latest release 0.3.5b
Code changes here r1428
To test this you need fresh installation of FQ on magento site that uses table 
prefixes.
If everything is OK FQ should work as usual. If fix is failing, you should get 
above SQL error.

Original comment by jamb...@gmail.com on 7 Mar 2011 at 2:06

GoogleCodeExporter commented 8 years ago
Shall we do a stable 1.0 release after this round of testing?

Original comment by zetapri...@gmail.com on 7 Mar 2011 at 9:34

GoogleCodeExporter commented 8 years ago
We probably should after 443 is sorted out

Original comment by jamb...@gmail.com on 8 Mar 2011 at 12:30

GoogleCodeExporter commented 8 years ago
Is this identical to
http://code.google.com/p/magento-w2p/issues/detail?id=459
?

Not sure how I can test this. Which one of our sites uses those required "table 
prefixes"?

To do a proper test, I guess I'll need to see the problem first. In other 
words, provoke the problem, get the err, update the extension and confirm the 
problem is gone. I don't think I've ever encountered this problem. Do we have 
this "foreign key" on our DEV instances?

Original comment by agur...@gmail.com on 8 Mar 2011 at 5:24

GoogleCodeExporter commented 8 years ago
For first question - not quite the same but similar.

None of our sites that I know uses table prefixes. If any of the sites is about 
to be reinstalled then it is good time to add prefixes to the tables. 
Installing new site just for this seems a bit over the top to me.

To test this you need like older version of extension - I think that current 
stable 1.0.0s has the problem. Foreign key is Database term and is part of 
table definition. We do have it on DEV.

Original comment by jamb...@gmail.com on 8 Mar 2011 at 5:31

GoogleCodeExporter commented 8 years ago
Anatoly, can you test this for us, please?

Original comment by zetapri...@gmail.com on 8 Mar 2011 at 5:38

GoogleCodeExporter commented 8 years ago
What I have to test? M.'s setup with table prefixes?

Original comment by Anatoly....@gmail.com on 9 Mar 2011 at 9:52

GoogleCodeExporter commented 8 years ago
If you have a quick way of setting up a site with table prefixes (may be 
reinstall magedev if no one is needing it). Then install 'stable' version of 
file uploader and witness the SQL error from this issue, and then update to 
current beta to witness SQL bug dissapear. I have made such local tests and all 
works fine, but some independent testing is required.

Original comment by jamb...@gmail.com on 9 Mar 2011 at 10:01

GoogleCodeExporter commented 8 years ago
Actually, it's a good example of how not to do it.
Anatoly should be getting a clear picture of what the issue is about, what was 
done and then make a call on what needs to be tested.

Doesn't need to be on DEV. Feel free to test locally, but you need to explain 
what you tested and what the results were.

Original comment by zetapri...@gmail.com on 15 Mar 2011 at 9:28

GoogleCodeExporter commented 8 years ago
The issue is about foreign keys failing because table names used were hard 
coded.
This is not the case for some time now.
I have tested this several times locally. Would anyone install magento using a 
prefix for DB tables and then install Fixed Qty and confirm if it works or not.

Original comment by jamb...@gmail.com on 11 Apr 2011 at 8:31

GoogleCodeExporter commented 8 years ago
Just a reminder that this go to be tested soon.

Original comment by ad...@zetaprints.com on 21 Apr 2011 at 12:52

GoogleCodeExporter commented 8 years ago
Again, I have tested this many times now it is no problem any more!

Original comment by jamb...@gmail.com on 21 Apr 2011 at 5:59

GoogleCodeExporter commented 8 years ago

Original comment by ad...@zetaprints.com on 21 Apr 2011 at 12:24