When i try to create new product it showing below error

"DDL statements are not allowed in transactions"

I have done research and found that in "vendor/magento/framework/DB/Adapter/Pdo/Mysql.php"

protected $_ddlRoutines = ['alt', 'cre', 'ren', 'dro', 'tru'];

if (in_array($startSql, $this->_ddlRoutines) && strcasecmp($sqlMessage[1], 'temporary') !== 0) {
                throw new ConnectionException(AdapterInterface::ERROR_DDL_MESSAGE, E_USER_ERROR);

It give error for this query "ALTER TABLE catalog_product_entity_tmp_indexer ADD PRIMARY KEY (entity_id)".

Simply it checks if sql starts with ALT and and its not temporary it throws error.

Any Idea why it happens.

Thanks Amit

1 Answer 1


I got the same error while edit product and I have fixed it by updating indexer "Update On Save" to "Update On Schedule".


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.