DatabaseMetaData#getImportedKeys() returns wrong value for DELETE_RULE #467
Labels
Waiting for Response
Waiting for a reply from the original poster, or affiliated party
Projects
Driver version or jar name
6.1.7
SQL Server version
13.0.4001.0
Client operating system
Windows 10
Java/JVM version
Oracle 8u144
Table schema
dbo
Problem description
DatabaseMetaData#getImportedKeys() returns UPDATE_RULE and DELETE_RULE columns with incorrect values.
Expected behavior and actual behavior
For a foreign key created with ON DELETE SET NULL, the JavaDoc says DELETE_RULE should be equal to the importedKeySetNull constant, which has a value of 2. But the driver reports 1.
The cause is that the data is obtained by executing sp_fkeys on the server. sp_fkeys only returns 0 or 1 for the delete and update actions (i.e. it does not provide detail at the level of granularity required). This also affects any other APIs (e.g. getExportedKeys()) that use sp_fkeys to get their data.
Possible solutions:
The text was updated successfully, but these errors were encountered: