From: | "Joe Shevland" <jshevland(at)j-elite(dot)com> |
---|---|
To: | "Dave Cramer" <Dave(at)micro-automation(dot)net>, <ian(at)labfire(dot)com> |
Cc: | <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: getImportedKeys returns only one key |
Date: | 2002-06-02 23:01:46 |
Message-ID: | HEECIHEEJDBMCCGMGIOBGECACIAA.jshevland@j-elite.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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... this is 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 performs below.
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_trigger t,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 AND t.tgfoid=p.oid AND tgisconstraint AND c2.relname='userorgs' AND i.indrelid=c.oid AND i.indexrelid=ic.oid AND i.indisprimary ORDER BY c.relname, c2.relname
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2002-06-02 23:19:10 | [Fwd: Re: getImportedKeys returns only one key] |
Previous Message | Ian Wehrman | 2002-06-02 20:03:03 | Re: getImportedKeys returns only one key |