Open chung1912 opened 1 month ago
👀 @chung1912
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
📦 Deployment environment
Docker
v1.15.10(Database version)
Windows
Chrome
Local plug-in updates will prompt an error: duplicate key value violates unique constraint "user_installed_plugins_user_id_identifier_pk"
No response
Expect to be able to update normally, do not uninstall and reinstall. After uninstalling and reinstalling, the setting information needs to be filled in again, which is quite troublesome.
No response
要解决在 Docker 上的 Windows 环境中使用 Chrome 浏览器时更新本地插件时出现的 "duplicate key value violates unique constraint" 错误,请确保 user_installed_plugins
表中的 identifier
字段是唯一的。此错误是由于尝试插入或更新具有唯一约束的列中的重复值而引起的。
user_installed_plugins
表的结构如下:
text
, not nulltext
, not nulltext
, not nulljsonb
, nullablejsonb
, nullablejsonb
, nullabletimestamp with time zone
, not null, default: now()
timestamp with time zone
, not null, default: now()
要解决此问题,可以按照以下步骤操作:
检查现有记录:在插入或更新插件之前,检查 user_installed_plugins
表中是否已经存在具有相同 identifier
的记录。
更新现有记录:如果存在具有相同 identifier
的记录,请更新现有记录而不是插入新记录。
生成唯一标识符:确保新插件具有唯一的 identifier
值,以避免冲突。
以下是检查现有记录并在必要时更新它们的示例:
-- 检查是否存在具有相同 identifier 的插件
SELECT id FROM user_installed_plugins WHERE identifier = 'your_plugin_identifier';
-- 如果存在记录,则更新它
UPDATE user_installed_plugins
SET name = 'new_name', manifest = 'new_manifest', settings = 'new_settings', updated_at = NOW()
WHERE identifier = 'your_plugin_identifier';
-- 如果不存在记录,则插入新记录
INSERT INTO user_installed_plugins (identifier, name, manifest, settings, created_at, updated_at)
VALUES ('your_plugin_identifier', 'new_name', 'new_manifest', 'new_settings', NOW(), NOW());
通过确保 identifier
的唯一性并适当地处理更新,可以避免 "duplicate key value violates unique constraint" 错误 [1][2].
To continue talking to Dosu, mention @dosu.
感觉是我实现的 bug,当时没测自定义插件的逻辑
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
It feels like it was a bug in my implementation. I didn’t test the logic of the custom plug-in at the time.
📦 部署环境
Docker
📌 软件版本
v1.15.10(Database版)
💻 系统环境
Windows
🌐 浏览器
Chrome
🐛 问题描述
本地插件更新会提示错误:duplicate key value violates unique constraint "user_installed_plugins_user_id_identifier_pk"
📷 复现步骤
No response
🚦 期望结果
期望可以正常更新,不要卸载重装。卸载重装后,设置信息需要重新填写,比较麻烦
📝 补充信息
No response