ERROR: duplicate key value violates unique constraint "xxx"
在postgresql中,由于为表的主键建立了自增序列,且数据是从正式库拷贝到正式库的,所以报错如下:
(主要原因:自增序列中的当前序列号小于真实数据中的最大主键值,因此在新增数据时,会报唯一值的错误。如图一)
(解决办法:修改自增序列中的当前序列号值为真实数据中最大的主键值。如图二)

图一

图二
ERROR: duplicate key value violates unique constraint "xxx"的更多相关文章
- [JAVA][Liferay] Duplicate key value violates unique constraint for resourcepermissionid in Liferay
Unexpected exception thrown when create new site: 09:47:10,114 ERROR [ajp-bio-8009-exec-113][JDBCExc ...
- postgres 错误duplicate key value violates unique constraint 解决方案
SELECT setval('tablename_id_seq', (SELECT MAX(id) FROM tablename)+1) 主要是:serial key其实是由sequence实现的,当 ...
- Error: Duplicate key name 'PCS_STATS_IDX' (state=42000,code=1061) ----Hive schematool -initSchema -dbType mysql
schematool -initSchema -dbType mysqlMetastore connection URL: jdbc:mysql://localhost/metastore_db?cr ...
- Error: Duplicate key name 'PCS_STATS_IDX' (state=42000,code=1061)
以下异常说明mysql已经启动. 应先关掉先前启动的mysql.再执行初始化schema操作. $service mysql stop; # $HIVE_HOME/bin/schematool -db ...
- Oracle 唯一 约束(unique constraint) 与 索引(index) 关系说明
一. 官网对Unique Constraints说明 http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/datainte.h ...
- mysql主从复制错误:Last_SQL_Error: Error 'Duplicate entry '327' for key 'PRIMARY'' on query. Default database: 'xxx'. Query: 'insert into
这个算不算解决,我都不太清楚,因为我感觉网上的说法,只是把错误忽略了,不表示以后用从库时不会出问题!!! 解决的办法是在从库上执行: mysql> slave stop; mysql> s ...
- Mysql中Insert into xxx on duplicate key update问题
要点:Insert into xxx on duplicate key update可以在唯一索引重复的情况下,进行更新操作. (1) 插入里边的字段应该只有一个 唯一索引: ...
- osm2pgsql导入duplicate key error in slim mode
This is a well known issue and one that is likely not going to be addressed any time soon. While the ...
- 转 OGG Troubleshooting-Database error 1 (ORA-00001: unique constraint ...)
Q5: After imp data to target, when we start replc process, we find the following error: 2011-11-10 0 ...
随机推荐
- django默认后台使用
1.初始化数据python manage.py migrate 2.创建超级用户python manage.py createsuperuser 然后按照提示输入就可以了 3.admin管理页面找不到 ...
- Jmeter JDBC Request--测试数据库连接 拒绝解决方案
有时会遇到回应信息如下: 1 Cannot create PoolableConnectionFactory (Access denied for user 'root'@'10.0.1.23' (u ...
- Webstorm/IntelliJ Idea 过期破解方法
一.Webstorm过期破解方法 如下图,WebStorm过期了,每次都是用30分钟,重新打开. 解决方法: 注册时,在打开的License Activation窗口中选择“License serve ...
- tornado 笔记
简单比较Django和Tornado Django是走大而全的方向,注重的是高效开发,最出名的是全自动化管理后台 Tornado走的是少而精的方向,注重的是性能的优化,最出名的是异步非堵塞 安装方式: ...
- iOS开发 SourceTree将develop合并到master分支的详细步骤
- jersey2+freemarker+spring3的集成
由于即将开始的新项目,是一个对外网开放访问权限的web应用.所以,公司技术管理层不允许使用struts以及spring mvc这一套.所以,我们开始转战曾经用作REST API的框架jersey及其周 ...
- PHP破解wifi密码(wifi万能钥匙的接口)
新建wifi.php,复制粘贴 <?php $bssid = $_POST["bssid"] ; $ssid = $_POST["ssid"] ; if ...
- 无法连接到 OPC服务器[无此类接口支持(异常来自HRESULT:0x80004002(E_NOINTERFACE))]
来源:https://stackoverrun.com/cn/q/10400663 无法连接到ABB Freelance OPC服务器[无此类接口支持(异常来自HRESULT:0x80004002(E ...
- WASAPI、DirectSound/DS、WaveOut、Kernel Streaming/KS
先放结论: ASIO:硬件支持+对应驱动程序 DS:兼容性最好,一般也是默认的. WASAPI:是Vista之后的,较佳选择输出方式. 再来详细看: ASIO.WDM都是指音频通道,就是音频数据走的路 ...
- sql培训
1.select--查询语句 select * from table; select cols from table; select cols from table where condition; ...