Table catalog_product_relation dosn't comes with the auto increment column. i want to create a custom id col with auto increment with the following query but not working. please help

ALTER TABLE catalog_product_relation ADD custom_id INT PRIMARY KEY AUTO_INCREMENT;

i am getting error called You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PRIMARY KEY' at line 1

1 Answer 1


Below query generated in adminer while altering table

enter image description here


ALTER TABLE `catalog_product_relation`
ADD `custom_id` int unsigned NOT NULL COMMENT 'Auto Increment' 

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.