Skip to content

Conversation

@sudarshan12s
Copy link
Owner

@sudarshan12s sudarshan12s commented Oct 14, 2023

Pull Request Checklist

  • Have you added new tests to prevent regressions?
  • If a documentation update is necessary, have you opened a PR to the documentation repository?
  • Did you update the typescript typings accordingly (if applicable)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Does the name of your PR follow our conventions?

Description Of Change

The issue is raised here

  • Enabled skipLocked, forShare, lockOuterJoinFailure, lock properties for Oracle dialect.
  • Oracle does not have shared locks on individual table rows, FOR UPDATE is what i found closest to
    forShare dialect support .
  • FOR UPDATE cant be used in sql's along with these :
    • ORDER BY
    • FETCH NEXT 1 ROWS ( creates a inline view, ...)

It results in error
ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.

We can instead generate a subquery like this , but it's not equivalent and is not correct all the time and might cause issues.
SELECT "id", "username", "awesome", "createdAt", "updatedAt" FROM "users" "user" WHERE rowid in (select rowid from "users" "user" where "user"."username" = 'jan' ORDER BY "user"."id" OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) FOR UPDATE;

Modified tests to use different model API's just to simulate the locking functionality .
-- findOrCreate is replaced with findAll and create
-- findByPK instead of findByOne

Todos

@sudarshan12s sudarshan12s changed the title - enable lock support. For shared locks use FOR UPDATE feat(oracle): support lock feature Oct 17, 2023
@sudarshan12s sudarshan12s merged commit f111e12 into v6 Oct 17, 2023
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.

2 participants