Re: getImportedKeys returns only one key

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

Ian,

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

Dave
On Sat, 2002-06-01 at 14:12, Ian Wehrman wrote:
> hello all,
> i have the following relations defined:
>
> create table users (
> UserID serial primary key,
> UserName varchar(255) unique not null,
> ...);
>
> create table Organizations (
> OrgID serial primary key,
> OrgName varchar(255) unique not null,
> ...);
>
> create table UserOrgs (
> OrgID int not null references organizations(orgid),
> UserID int not null references users(userid),
> primary key (userid,orgid)
> );
>
>
> and the following bit of code:
>
> Connection cn = DriverManager.getConnection(url, user, pass);
> DatabaseMetaData dbmd = cn.getMetaData();
> ResultSet rs = dbmd.getImportedKeys(null, null, "userorgs");
> while (rs.next()) {
> out.println(rs.getString("PKTABLE_NAME"));
> }
>
> ...which prints only "organizations". In other tests I've repeatedly found
> that the ResultSet returned by getImportedKeys never contains more than one
> row. I've tested this with the latest stable jdbc driver, the latest
> development driver, and with a driver compiled from cvs. I'm currently running
> postgresql-7.1.3 on the server. Can anyone give me a hint as to what i'm doing
> wrong, or is this a problem with the driver?
>
> Thanks,
> Ian Wehrman
>
> --
> Labfire, Inc.
> Seamless Technical Solutions
> http://labfire.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ian Wehrman 2002-06-02 20:03:03 Re: getImportedKeys returns only one key
Previous Message Ian Wehrman 2002-06-02 16:05:21 Re: getImportedKeys returns only one key