0

I have 2 tables joined with an associative table in PostgreSQL 9.5.3, front end Librebase with a join as follows (pk woid--> fk woid fk UNIQUE_ID--> pk UNIQUE_ID (woid varchar, UNIQUE_ID BigInt(8)). How this works in HSQL is from an entry in the wotbl(pk woid) I can associate 2 or three entries from the civictbl (pk UNIQUE_ID) through my jtbl_cwo(pk((fk woid)(fk UNIQUE_ID))). The jtbl_cwo takes the pk from each entry. However when I do this in PostgreSQL I get the error;

    "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')')

It looks to me that the jtbl_cwo is taking the woid but not the UNIQUE_ID from the civictbl. Any ideas on how to resolve this error?

MrKingsley
  • 171
  • 1
  • 10
  • Please accept answers to your other questions. Go into your StackOverflow user profile to see all the questions you have asked. – Jim K Jul 21 '16 at 20:35
  • Your description is unclear, and possibly not acutally what the code does. Please show your DDL, DML and table values. Please read about and provide a [mcve]. – philipxy Jul 22 '16 at 11:01
  • What is DDL and DML? What do you mean by table values? the data types for each table column or the entries? the wotbl and the jtbl_cwo tables have no entries; I am trying to add entries but get the error. The civictbl holds over 12000 entries. I also do not know how to make the join more clear, could you please show me an example of how to properly outline a table join using text? I could post the SQL Statement being used if that would help? I went back and accepted all the answers to my questions except the one I answered myself, apparently I cannot do that. – MrKingsley Jul 22 '16 at 12:41
  • Sorry I am not a programmer and don't know the lingo or terms very well; often I find answers to my issues by with a second google/search using a proper term or statement that I previously did not know. I often get that info from reading over this site. – MrKingsley Jul 22 '16 at 12:42

0 Answers0