Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: EXPOSED-173 UPDATE_RULE read incorrectly for Oracle #1865

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

joc-a
Copy link
Collaborator

@joc-a joc-a commented Sep 21, 2023

Although the documentation of the driver mentions UPDATE_RULE here, it is missing from the ALL_CONSTRAINTS view here. Only DELETE_RULE is mentioned.

This is part of the SQL that runs when OracleDatabaseMetadata.getImportedKeys() is invoked:

SELECT NULL AS pktable_cat,
p.owner as pktable_schem,
p.table_name as pktable_name,
pc.column_name as pkcolumn_name,
NULL as fktable_cat,
f.owner as fktable_schem,
f.table_name as fktable_name,
fc.column_name as fkcolumn_name,
fc.position as key_seq,
NULL as update_rule,
decode (f.delete_rule, 'CASCADE', 0, 'SET NULL', 2, 1) as delete_rule
...

update_rule is hardcoded to NULL, which gets converted to 0 when using getInt("UPDATE_RULE"), and is then mistakenly taken to represent DatabaseMetaData.importedKeyCascade = 0.

@joc-a joc-a force-pushed the joc/sqlserver-restrict-reference-option-unsupported branch from 29ed38c to 6eb2bee Compare September 21, 2023 17:16
@joc-a joc-a changed the base branch from joc/sqlserver-restrict-reference-option-unsupported to main September 22, 2023 10:16
@joc-a joc-a marked this pull request as ready for review September 22, 2023 11:21
@joc-a joc-a requested review from e5l and bog-walk September 22, 2023 11:22
Oracle does not support UPDATE_RULE and returns NULL for it, but getInt returns 0 instead of NULL, which represents CASCADE.
@joc-a joc-a merged commit 8550a32 into main Sep 25, 2023
5 checks passed
@joc-a joc-a deleted the joc/oracle-update-rule-fix branch September 25, 2023 08:43
saral pushed a commit to saral/Exposed that referenced this pull request Oct 3, 2023
)

In Oracle, update_rule is hardcoded to NULL, which gets converted to 0 when using getInt("UPDATE_RULE"), and is then mistakenly taken to represent DatabaseMetaData.importedKeyCascade = 0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants