我有一个带有模式的表:
Table: "public.system_configuration_parameter"
Column | Type | Collation | Nullable | Default
---------------+-----------------------------+-----------+----------+--------------------------------------------------
id | integer | | not null | nextval('system_configuration_id_seq'::regclass)
name | character varying | | not null |
type | character varying | | not null |
value | character varying | | |
default_value | character varying | | not null |
date_added | timestamp without time zone | | not null | now()
date_modified | timestamp without time zone | | not null | now()
Indexes:
"system_configuration_parameter_pkey" PRIMARY KEY, btree (id)
"system_configuration_parameter_name_key" UNIQUE CONSTRAINT, btree (name)以下查询结果为错误:
insert into system_configuration_parameter (name, type, value ,default_value) values ('serverPerformanceMode','String','standardMode','standardMode');
ERROR: duplicate key value violates unique constraint "system_configuration_parameter_name_key"
DETAIL: Key (name)=(serverPerformanceMode) already exists.问题是,在名称为“serverPerformanceMode”的表中不存在任何条目。
shubhdb=# select value from system_configuration_parameter where name = ('serverPerformanceMode');
(0 rows)我正在使用postgres 9.3,我已经完成了postgres到升级版10的迁移,目前我的系统中已经安装了这两个版本。
我曾经使用相同的数据库,具有相同的结构,它以前运行得非常好。这甚至在postgres-10上都很好,只有当我使用postgres-9.3和相同的构建时才会出现问题。
有人知道这件事吗?还是面临着同样的问题?
感谢您的阅读。
发布于 2019-12-09 16:37:05
这种类型的问题通常是由用户错误引起的。您可能连接到一个数据库来执行插入,另一个连接到执行查询的不同数据库(或者可能是同一个数据库的不同模式)。您能使用相同的连接对象,而不是在不同的连接上手动运行查询,从而使插入跟踪错误的代码吗?
https://stackoverflow.com/questions/59249738
复制相似问题