[CONJ-1019] DatabaseMetaData.getImportedKeys should return real value for PK_NAME column Created: 2022-10-25  Updated: 2022-11-03  Resolved: 2022-11-03

Status: Closed
Project: MariaDB Connector/J
Component/s: metadata
Affects Version/s: 2.6.0
Fix Version/s: 2.7.7, 3.0.9, 3.1.0

Type: Bug Priority: Major
Reporter: Peer Törngren Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: metadata

Issue Links:
Problem/Incident
is caused by CONJ-764 DatabaseMetaData.getExportedKeys shou... Closed

 Description   

For consistency with the change made in CONJ-764 and since primary keys are named PRIMARY (see MariaDbDatabaseMetaData.getPrimaryKeys), DatabaseMetaData.getImportedKeys should return PRIMARY (instead of "null") for PK_NAME column.

With the change made for the PK column in exported keys, it is no longer possible to match an exported key from one table with the imported key in the related table.



 Comments   
Comment by Diego Dupin [ 2022-10-31 ]

Currently, there is 2 differents implementations :

  • using SHOW CREATE TABLE
  • using INFORMATION_SCHEMA tables.

SHOW CREATE TABLE is way faster (benchmark on my computer show 20x faster) than using INFORMATION_SCHEMA but with the issue of having PK_NAME null. Actually I_S tables request is only done when catalog is not set (required for SHOW CREATE TABLE)

I agree that current implementation is not consistent, and must be corrected.
Correction will returns primary key name (so not only "PRIMARY", but unique key names as well)

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