[CONJ-66] Regression in DatabaseMetaData.getPrimaryKeys() Created: 2013-09-20  Updated: 2013-09-20  Resolved: 2013-09-20

Status: Closed
Project: MariaDB Connector/J
Component/s: None
Affects Version/s: 1.1.5
Fix Version/s: 1.1.6

Type: Bug Priority: Major
Reporter: Lukas Eder Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to CONJ-41 connection.getMetaData().getPrimaryK... Closed

 Description   

When upgrading jOOQ integration tests from MariaDB JDBC driver 1.1.2 to 1.1.5, I discovered a regression, probably introduced with CONJ-41.

Here's how to reproduce:

CREATE TABLE t1 (
  id1 integer,
  constraint pk primary key(id1)
);
CREATE TABLE t2 (
  id2a integer,
  id2b integer,
  constraint pk primary key(id2a, id2b),
  constraint fk1 foreign key(id2a) references t1(id1),
  constraint fk2 foreign key(id2b) references t1(id1)
);

Now, call

connection.getMetaData().getPrimaryKeys(null, null, "t2")

This will produce duplicate rows as can be seen here:

+---------+-----------+----------+-----------+-------+-------+
|TABLE_CAT|TABLE_SCHEM|TABLE_NAME|COLUMN_NAME|KEY_SEQ|PK_NAME|
+---------+-----------+----------+-----------+-------+-------+
|test     |{null}     |t2        |id2a       |      1|{null} |
|test     |{null}     |t2        |id2b       |      1|{null} |    <--- bad record
|test     |{null}     |t2        |id2b       |      2|{null} |
+---------+-----------+----------+-----------+-------+-------+



 Comments   
Comment by Lukas Eder [ 2013-09-20 ]

That was very quick, thanks!

Generated at Thu Feb 08 03:12:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.