Re: getImportedKeys returns only one key - Mailing list pgsql-jdbc

From Joe Shevland
Subject Re: getImportedKeys returns only one key
Date
Msg-id HEECIHEEJDBMCCGMGIOBGECACIAA.jshevland@j-elite.com
Whole thread Raw
In response to Re: getImportedKeys returns only one key  (Dave Cramer <Dave@micro-automation.net>)
List pgsql-jdbc
Hi Dave,

I tried Ian's test last night on Cygwin/PostgreSQL 7.2.1 (with the bundled jar), and it still only returns one row...
thisis without explicitly naming the constraints (just uses the references clause). 

The actual query the driver performs returns four rows (an update/delete rule or trigger each for organizations and
users),but I'm not sure where the JDBC code is falling down at this stage or what it is basing an imported key as
being...the code for getImportedExportedKeys() looks like the spot, and it sounds like it may be because they are
'<unnamed>',but I haven't read through the entire code for the method yet. I've attached the query the JDBC driver
performsbelow. 

Cheers,
Joe

> I tried my test code on a 7.1.3 db and it worked fine, one thin I did
> notice is that I am specifically creating foreign key constraints. I
> don't have time right now to test to see if that makes a difference, but
> if you can; let me know
>
>
> here's an idea how I defined my tables
>
>           JDBC2Tests.createTable( con1, "users", "id int4
> primary key,
> people_id int4, policy_id int4,"+
>                                     "CONSTRAINT people FOREIGN KEY
> (people_id) references people(id),"+
>                                     "constraint policy FOREIGN KEY
> (policy_id) references policy(id)" );

FK query:

SELECT c.relname,c2.relname,t.tgconstrname,ic.relname,t.tgdeferrable,t.tginitdeferred,t.tgnargs,t.tgargs,p.proname FROM
pg_triggert,pg_class c,pg_class c2,pg_class ic,pg_proc p, pg_index i WHERE t.tgrelid=c.oid AND t.tgconstrrelid=c2.oid
ANDt.tgfoid=p.oid AND tgisconstraint AND c2.relname='userorgs' AND i.indrelid=c.oid AND i.indexrelid=ic.oid AND
i.indisprimaryORDER BY c.relname, c2.relname 


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: getImportedKeys returns only one key
Next
From: Dave Cramer
Date:
Subject: [Fwd: Re: getImportedKeys returns only one key]