Silvio Brandani wrote:
> We have problems changing postgres jdbc driver from postgresql-9.3-1102.jdbc41.jar to postgresql-
> 9.4.1208.jar
>
> we have table ap_invoice_t
>
> Referenced by:
> TABLE "ap_invoice_m" CONSTRAINT "ap_invoice_m_fkey" FOREIGN KEY (branch_cod, orig_doc, doc_year,
> azienda) REFERENCES "123".ap_invoice_t(branch_cod, orig_doc, doc_year, azienda) ON DELETE CASCADE
>
> the following operations are executed in order:
[...]
> INSERT INTO ap_invoice_t (branch_cod, doc_year, orig_doc, [...] azienda)
> values
> ($1, $2, $3, [...] $40)
>
> $1 = '2150100078', $2 = '2015', $3 = '0000079369', [...] $40 = 'CX'
>
>
> INSERT INTO ap_invoice_m (branch_cod, cod_voce, doc_year, orig_doc, progr, des_voce, imp_voce,
> azienda) values ($1, $2, $3, $4, $5, $6, $7, $8)
> DETAIL: parameters: $1 = '2150100078', $2 = 'M01', $3 = '2015', $4 = '0000079369', $5 = '1', $6 =
> 'OCEAN IMPORT FREIGHT', $7 = '150', $8 = 'CX'
> ERROR: insert or update on table "ap_invoice_m" violates foreign key constraint "ap_invoice_m_fkey"
> DETAIL: Key (branch_cod, orig_doc, doc_year, azienda)=(2150100078 , 0000079369 , 2015, CX ) is not
> present in table "ap_invoice_t".
> STATEMENT: INSERT INTO ap_invoice_m (branch_cod, cod_voce, doc_year, orig_doc, progr, des_voce,
> imp_voce, azienda) values ($1, $2, $3, $4, $5, $6, $7, $8)
>
> as you se we get unexpectedly Foreing key violation
Turn on server logging (log_statement=all) in postgresql.conf and examine the
server log:
- Are the two statements executed in the correct order?
- Are statements executed on the same database connection (same session ID in the log)?
It does not look like a JDBC driver problem at first glace.
Yours,
Laurenz Albe