Re: getImportedKeys returns only one key

From: Ian Wehrman <ian(at)labfire(dot)com>
To: Dave Cramer <Dave(at)micro-automation(dot)net>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: getImportedKeys returns only one key
Date: 2002-06-02 20:03:03
Message-ID: 20020602150303.A17320@labfire.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Dave Cramer <Dave(at)micro-automation(dot)net> wrote:
> 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

Dave,
Thanks for your help. I did a bit more testing with this hint, and I think
I've narrowed the problem down further. I can verify that your tests work as
expected, getImportedKeys shows all FOREIGN KEYs that are explicitly created.
The difference, I suspect, is that the FORIEGN KEY attribute is a table
constraint, while the syntax i used created a column constraint. I'm not
entirely sure what the difference is, I only glean this from the psql help for
"create table." So, you're right that table constraints are working fine, but
it does seem that only the last column constraint is showing up in
getImportedKeys(). Try adding the following to your test harness, and I
think you'll see that only one of the constraints show up:

JDBC2Tests.createTable(con1, "users", "id int4 primary key, " +
"people_id int4 references people(id), " +
"policy_id int4 references policy(id)");

I can verify (with "\d tablename") that creating either table or column
constraints properly creates the triggers (of the form
RI_ConstraintTrigger_xxxxx), so it seems like these should be returned by
getImportedKeys(). Thanks for helping me find a workaround though, and let me
know if I can help test any futher.

Thanks,
Ian Wehrman

--
Labfire, Inc.
Seamless Technical Solutions
http://labfire.com/

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Joe Shevland 2002-06-02 23:01:46 Re: getImportedKeys returns only one key
Previous Message Dave Cramer 2002-06-02 18:01:18 Re: getImportedKeys returns only one key