Thread: Can't get all Imported Keys from dmd
The following code SHOULD (according to the JDK1.4 docs) get all the primary keys related to a table's foreign keys, if I read the docs right. But I get back a ResultSet only containing one (1) key, not two, as in my table. Can someone explain this to me? Why won't it return all the keys in the ResultSet? Thanks! ResultSet fkpk = dmd.getImportedKeys("", "", "login"); while (fkpk.next()) { System.out.println("PK: " + fkpk.getString("PKTABLE_NAME")); System.out.println("\t" + fkpk.getString("PKCOLUMN_NAME")); System.out.println("FK: " + fkpk.getString("FKTABLE_NAME")); System.out.println("\t" + fkpk.getString("FKCOLUMN_NAME")); } System.out.println(" "); ********************************** Table creation script: drop table login; drop sequence login_id_seq; create table login( id serial primary key, memberid int references members(id), userid varchar(15) not null, password varchar(15) not null, verification char(20), verifydatesent date, verifydaterecd date, accesslevel int references accesslevels(id), remoteip varchar(16), reminderquestion varchar(80), reminderanswer varchar(25) ); create index idxloginid on login(id); create index idxlogin_memberid on members(id); ********************************** Test results: PK: accesslevels id FK: login accesslevel -- David A. Bartmess Software Configuration Manager / Sr. Software Developer eDingo Enterprises http://edingo.net
David, Try the development driver, this has been fixed in the latest sources Dave On Tue, 2002-06-25 at 12:15, David A. Bartmess wrote: > The following code SHOULD (according to the JDK1.4 docs) get all the > primary keys related to a table's foreign keys, if I read the docs > right. But I get back a ResultSet only containing one (1) key, not two, > as in my table. > > Can someone explain this to me? Why won't it return all the keys in the > ResultSet? > > Thanks! > > ResultSet fkpk = dmd.getImportedKeys("", "", "login"); > > while (fkpk.next()) > { > System.out.println("PK: " + fkpk.getString("PKTABLE_NAME")); > System.out.println("\t" + fkpk.getString("PKCOLUMN_NAME")); > System.out.println("FK: " + fkpk.getString("FKTABLE_NAME")); > System.out.println("\t" + fkpk.getString("FKCOLUMN_NAME")); > } > > System.out.println(" "); > ********************************** > Table creation script: > > drop table login; > drop sequence login_id_seq; > > create table login( > id serial primary key, > memberid int references members(id), > userid varchar(15) not null, > password varchar(15) not null, > verification char(20), > verifydatesent date, > verifydaterecd date, > accesslevel int references accesslevels(id), > remoteip varchar(16), > reminderquestion varchar(80), > reminderanswer varchar(25) > ); > create index idxloginid on login(id); > create index idxlogin_memberid on members(id); > > > ********************************** > Test results: > > PK: accesslevels > id > FK: login > accesslevel > > > > -- > David A. Bartmess > Software Configuration Manager / Sr. Software Developer > eDingo Enterprises > http://edingo.net > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > >
The development driver for the jdbc? Or the odbc driver in the postgresql release? Thanks! On Tue, 2002-06-25 at 10:22, Dave Cramer wrote: > David, > > Try the development driver, this has been fixed in the latest sources > > Dave > On Tue, 2002-06-25 at 12:15, David A. Bartmess wrote: > > The following code SHOULD (according to the JDK1.4 docs) get all the > > primary keys related to a table's foreign keys, if I read the docs > > right. But I get back a ResultSet only containing one (1) key, not two, > > as in my table. > > > > Can someone explain this to me? Why won't it return all the keys in the > > ResultSet? > > > > Thanks! > > > > ResultSet fkpk = dmd.getImportedKeys("", "", "login"); > > > > while (fkpk.next()) > > { > > System.out.println("PK: " + fkpk.getString("PKTABLE_NAME")); > > System.out.println("\t" + fkpk.getString("PKCOLUMN_NAME")); > > System.out.println("FK: " + fkpk.getString("FKTABLE_NAME")); > > System.out.println("\t" + fkpk.getString("FKCOLUMN_NAME")); > > } > > > > System.out.println(" "); > > ********************************** > > Table creation script: > > > > drop table login; > > drop sequence login_id_seq; > > > > create table login( > > id serial primary key, > > memberid int references members(id), > > userid varchar(15) not null, > > password varchar(15) not null, > > verification char(20), > > verifydatesent date, > > verifydaterecd date, > > accesslevel int references accesslevels(id), > > remoteip varchar(16), > > reminderquestion varchar(80), > > reminderanswer varchar(25) > > ); > > create index idxloginid on login(id); > > create index idxlogin_memberid on members(id); > > > > > > ********************************** > > Test results: > > > > PK: accesslevels > > id > > FK: login > > accesslevel > > > > > > > > -- > > David A. Bartmess > > Software Configuration Manager / Sr. Software Developer > > eDingo Enterprises > > http://edingo.net > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 4: Don't 'kill -9' the postmaster > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > > -- David A. Bartmess Software Configuration Manager / Sr. Software Developer eDingo Enterprises http://edingo.net
Never mind... Thanks, I got it! It's SO nice when my problems are fixed and ready to update before I get to them! LOL On Tue, 2002-06-25 at 11:27, David A. Bartmess wrote: > The development driver for the jdbc? Or the odbc driver in the > postgresql release? > > Thanks! > > On Tue, 2002-06-25 at 10:22, Dave Cramer wrote: > > David, > > > > Try the development driver, this has been fixed in the latest sources > > > > Dave > > On Tue, 2002-06-25 at 12:15, David A. Bartmess wrote: > > > The following code SHOULD (according to the JDK1.4 docs) get all the > > > primary keys related to a table's foreign keys, if I read the docs > > > right. But I get back a ResultSet only containing one (1) key, not two, > > > as in my table. > > > > > > Can someone explain this to me? Why won't it return all the keys in the > > > ResultSet? > > > > > > Thanks! > > > > > > ResultSet fkpk = dmd.getImportedKeys("", "", "login"); > > > > > > while (fkpk.next()) > > > { > > > System.out.println("PK: " + fkpk.getString("PKTABLE_NAME")); > > > System.out.println("\t" + fkpk.getString("PKCOLUMN_NAME")); > > > System.out.println("FK: " + fkpk.getString("FKTABLE_NAME")); > > > System.out.println("\t" + fkpk.getString("FKCOLUMN_NAME")); > > > } > > > > > > System.out.println(" "); > > > ********************************** > > > Table creation script: > > > > > > drop table login; > > > drop sequence login_id_seq; > > > > > > create table login( > > > id serial primary key, > > > memberid int references members(id), > > > userid varchar(15) not null, > > > password varchar(15) not null, > > > verification char(20), > > > verifydatesent date, > > > verifydaterecd date, > > > accesslevel int references accesslevels(id), > > > remoteip varchar(16), > > > reminderquestion varchar(80), > > > reminderanswer varchar(25) > > > ); > > > create index idxloginid on login(id); > > > create index idxlogin_memberid on members(id); > > > > > > > > > ********************************** > > > Test results: > > > > > > PK: accesslevels > > > id > > > FK: login > > > accesslevel > > > > > > > > > > > > -- > > > David A. Bartmess > > > Software Configuration Manager / Sr. Software Developer > > > eDingo Enterprises > > > http://edingo.net > > > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 4: Don't 'kill -9' the postmaster > > > > > > > > > > > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 3: if posting/reading through Usenet, please send an appropriate > > subscribe-nomail command to majordomo@postgresql.org so that your > > message can get through to the mailing list cleanly > > > > > > > -- > David A. Bartmess > Software Configuration Manager / Sr. Software Developer > eDingo Enterprises > http://edingo.net > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html > > > -- David A. Bartmess Software Configuration Manager / Sr. Software Developer eDingo Enterprises http://edingo.net