Multi column foreign keys. - Mailing list pgsql-jdbc

From Mofeed Shahin
Subject Multi column foreign keys.
Date
Msg-id 200312091436.32439.mofeed.shahin@dsto.defence.gov.au
Whole thread Raw
Responses Re: Multi column foreign keys.
List pgsql-jdbc
Hello all,

I've got the following tables :

CREATE TABLE Student
(
    Student_ID    serial PRIMARY KEY,
    First_Name    varchar(50),
    Last_Name    varchar(50),
    UNIQUE (First_Name, Last_Name)
);

CREATE TABLE Address
(
    First_Name    varchar(50),
    Last_Name    varchar(50),
    Address        varchar(50),
    PRIMARY KEY (First_Name, Last_Name),
    FOREIGN KEY (First_Name, Last_Name) REFERENCES student (First_Name,Last_Name)
);

And some code like :

Driver driver = (Driver)Class.forName("org.postgresql.Driver").newInstance();
DriverManager.registerDriver(driver);
String     url = "jdbc:postgresql:test";
Connection con = DriverManager.getConnection(url, "mof", "");
DatabaseMetaData meta = con.getMetaData ();
ResultSet metaRS = meta.getImportedKeys(null, null, "address");

while (metaRS.next())
    System.out.println("FK_C == " + metaRS.getString("FKCOLUMN_NAME"));

Which only gives me :

FK_C == first_name

How am I supposed to find out about "Last_Name" ?

Mof.





pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: CMP Bean problem
Next
From: TANIDA Yutaka
Date:
Subject: Re: CMP Bean problem