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-178 DELETE_RULE read incorrectly for Oracle #1868

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

joc-a
Copy link
Collaborator

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

Oracle returns CASCADE=0, SET_NULL=2, and NO_ACTION=1
decode (f.delete_rule, 'CASCADE', 0, 'SET NULL', 2, 1) as delete_rule

So when it returns 1, which in the current code corresponds to DatabaseMetaData.importedKeyRestrict, it is mapped to RESTRICT, which is not supported in Oracle. Instead of that, it will now be mapped to NO_ACTION.

The resolveRefOptionFromJdbc function was moved from Constraints.kt to DatabaseDialect.kt.

Oracle returns CASCADE=0, SET_NULL=2, and NO_ACTION=1
`decode (f.delete_rule, 'CASCADE', 0, 'SET NULL', 2, 1) as delete_rule`

So when it returns 1, which in the current code corresponds to DatabaseMetaData.importedKeyRestrict, it will now be mapped to NO_ACTION because Oracle does not have the RESTRICT reference option. NO_ACTION behaves likes RESTRICT for it.
@joc-a joc-a force-pushed the joc/oracle-delete-rule-fix branch from 6067a1d to aafda2b Compare September 25, 2023 09:04
@joc-a joc-a marked this pull request as ready for review September 25, 2023 09:49
@joc-a joc-a requested review from e5l and bog-walk September 25, 2023 09:49
Copy link
Member

@e5l e5l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@joc-a joc-a merged commit 3b4402a into main Sep 25, 2023
3 checks passed
@joc-a joc-a deleted the joc/oracle-delete-rule-fix branch September 25, 2023 10:25
saral pushed a commit to saral/Exposed that referenced this pull request Oct 3, 2023
)

Oracle returns CASCADE=0, SET_NULL=2, and NO_ACTION=1
`decode (f.delete_rule, 'CASCADE', 0, 'SET NULL', 2, 1) as delete_rule`

So when it returns 1, which in the current code corresponds to DatabaseMetaData.importedKeyRestrict, it is mapped to RESTRICT, which is not supported in Oracle. Instead of that, it will now be mapped to NO_ACTION.

The resolveRefOptionFromJdbc function was moved from Constraints.kt to DatabaseDialect.kt.
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