Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
3.3.3
-
None
-
Tested with
database in docker (mariadb:latest and mariadb:10.6.5)
database drivers: 3.3.3
java: OpenJDK Runtime Environment (build 17.0.10+7-Ubuntu-123.10.1)
Description
I started an empty docker image.
I created a database and added the two tables in the attached script.
I then compiled and ran the attached java program.
The goal of the java program is to use the getExportedKeys and getImportedKeys to find the foreign key reference between the two tables.
Looking at the result we see that depending on how we connect to the database and what properties we set we get different results for the PK_NAME field: sometimes we get null, sometimes we get the index name that the foreign key uses.
IF we look at the javadoc for DatabaseMetaData we see that the field PK_NAME is supposed to return "PK_NAME String => primary key name (may be null)" so returning an index name is a bit odd, but more useful than returning null.
Wanted/Expected:
That getExportedKeys and getImportedKeys return matching results.
Other:
Looking in the driver we see that it looks at a flag and decides to either use show-tables or a query on the key_column_usage to find the results.
Attachments
Issue Links
- relates to
-
CONJ-1019 DatabaseMetaData.getImportedKeys should return real value for PK_NAME column
-
- Closed
-