5

After upgrade from magento 2.1.7 to 2.2.3 and am stuck. I have tried everything.

In Pdo.php line 235:
SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to './zwwnzwzjhe/customer_group' (errno: 150 - Foreign key constraint is incorrectly formed), query was: ALTER TABLE customer_group MODIFY COLUMN customer_group_id int(10) UNSIGNED NOT NULL AUTO_INCREMENT

In Pdo.php line 228: SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to './zwwnzwzjhe/customer_group' (errno: 150 - Foreign key constraint is incorrectly formed)

I am unable to delete this table or make any changes to this table ...please help.

Thank you

1 Answer 1

1

To work around this, use either of these solutions. Both present risks of damaging the data integrity.

Option 1:

Remove constraints
Perform TRUNCATE
Delete manually the rows that now have references to nowhere
Create constraints

Option 2:

SET FOREIGN_KEY_CHECKS = 0; 
TRUNCATE table customer_group; 
SET FOREIGN_KEY_CHECKS = 1;
7
  • nothing works I am unable to delete manually due to foreign key, Option 2 also doesnt work when i truncate, I get the Cannot truncate a table referenced in a foreign key constraint (zwwnzwzjhe.catalog_product_bundle_price_index, CONSTRAINT catalog_product_bundle_price_index_ibfk_1 FOREIGN KEY (customer_group_id) REFERENCES zwwnzwzjhe.customer_group (`customer_) 16:14:18 SQL command
    – roger
    Commented Mar 3, 2019 at 16:15
  • @roger even when you are using second option ? Commented Mar 3, 2019 at 16:16
  • Yes SET FOREIGN_KEY_CHECKS = 0 Query executed OK, 0 rows affected. (0.000 s) Edit TRUNCATE table customer_group Query executed OK, 0 rows affected. (0.023 s) Edit SET FOREIGN_KEY_CHECKS = 1 Query executed OK, 0 rows affected. (0.000 s) Edit
    – roger
    Commented Mar 3, 2019 at 16:20
  • Query seems to be executed , i don't see any errors @roger Commented Mar 3, 2019 at 16:30
  • 0 rows affected. i still get the same error so I am guessing now effect is taking place
    – roger
    Commented Mar 3, 2019 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.