SQLSTATE[23000]:违反完整性约束:1062 键“IDX_STOCK_PRODUCT"的重复条目“1922-1" [英] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1922-1' for key 'IDX_STOCK_PRODUCT'

查看:28
本文介绍了SQLSTATE[23000]:违反完整性约束:1062 键“IDX_STOCK_PRODUCT"的重复条目“1922-1"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建产品时,在检索一段时间后的最后一步,Magento给出以下错误-:

While creating product, at the last step after retrieving for a time, Magento gives following error-:

SQLSTATE[23000]:违反完整性约束:1062 键IDX_STOCK_PRODUCT"的重复条目1922-1"

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1922-1' for key 'IDX_STOCK_PRODUCT'

我正在做的是,通过捕获产品 ID,我将它的条目放入自定义表中.我已从外部连接到 Magento 数据库.

What I am doing is, by capturing product id, I am putting it's entry in custom table. I have connected to Magento database externally.

出人意料的是,数据同时插入了 Magento 的基表 &也在自定义表中,但为什么它在产品保存后给我那个错误...?

Surprisingly data is inserted in both Magento's base table & also in Custom table but why it is giving me that error after product saving...?

我清除了缓存、浏览器 cookie.同时删除/var/cache、/var/session.仍然给出错误.有人可以提出解决方案吗?

I cleared cache, browser cookies. Also remove /var/cache, /var/session. still giving error. Can anybody suggest a solution?

推荐答案

该消息意味着您正在使用作为 IDX_STOCK_PRODUCT 一部分的列的相同组合进行另一个插入,该 IDX_STOCK_PRODUCT 接缝被定义为 UNIQUE.如果是这样,则不允许两次输入相同的组合(似乎它由两个字段组成).

the message means you are doing another insert with the same combination of columns that are part of the IDX_STOCK_PRODUCT, which seams to be defined as UNIQUE. If it is so, it doesn't allow to enter same combination (it seems like it consists of two fields) twice.

如果您要插入记录,请确保您选择的是全新的记录 ID 或记录 ID 与另一列的组合是唯一的.

If you are inserting records, make sure you are picking brand new record id or that the combination of record id and the other column is unique.

没有详细的表结构和你的代码,我们很难猜出哪里出了问题.

Without detailed table structure and your code, we can hardly guess whats going wrong.

这篇关于SQLSTATE[23000]:违反完整性约束:1062 键“IDX_STOCK_PRODUCT"的重复条目“1922-1"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆