关联表不会使用其中一个主键

时间:2016-07-21 11:08:28

标签: postgresql foreign-keys entity-relationship libreoffice-base

我有2个表与PostgreSQL 9.5.3中的关联表连接,前端Librebase有一个连接如下(pk woid - > fk woid fk UNIQUE_ID - > pk UNIQUE_ID(woid varchar,UNIQUE_ID BigInt( 8))。这在HSQL中是如何工作的,来自wotbl中的条目(pk woid)我可以将civictbl(pk UNIQUE_ID)中的2或3个条目与我的jtbl_cwo(pk((fk woid)(fk UNIQUE_ID))相关联) .jtbl_cwo从每个条目中获取pk。但是当我在PostgreSQL中执行此操作时,我得到了错误;

    "pq_Driver:[PGRES_FATAL_ERROR]ERROR: insert or update on table
    "jtbl_cwo" violates foreign key constraint "UNIQUE_ID_fkey" DETAIL:
    Key(UNIQUE_ID)=(0) is not present in table "civictbl". (caused by 
    statment 'INSERT INTO "wotracking"."jtbl_cwo" ("UNIQUE_ID","woid")
    VALUES ('0','BB306-16')')

在我看来,jtbl_cwo正在采取woid而不是civictbl中的UNIQUE_ID。有关如何解决此错误的任何想法?

0 个答案:

没有答案