表...中没有关键...但是它已经存在。 (复制Postgres)

时间:2017-04-07 21:37:57

标签: postgresql copy key

尝试时:

copy qe_direito_incidencia from 'C:\\temp\\Direito_Incidencia_04-04-17.txt' with delimiter E'\t' null as '';

我有这个错误:

ERROR: insert or update on table "qe_direito_incidencia" violates foreign key constraint "qe_direito_incidencia_cod_empresa_fkey"
SQL state: 23503
Detail: Key (cod_empresa, cod_direito)=(1, 78) is not present in table "qe_direito".

但是我在两个表中有这个记录,qe_direito和qe_direito_incidencia。

有什么想法吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

我已经解决了。但我需要将导出excel更改为CSV。当我尝试像TXT一样导出它时,它不起作用并报告上面的错误。