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

Support SKIP LOCKED with FOR SHARE in Postgres #8911

Closed
matgr1 opened this issue Apr 18, 2022 · 0 comments · Fixed by #9317
Closed

Support SKIP LOCKED with FOR SHARE in Postgres #8911

matgr1 opened this issue Apr 18, 2022 · 0 comments · Fixed by #9317

Comments

@matgr1
Copy link

matgr1 commented Apr 18, 2022

Feature Description

#5927 added support for SKIP LOCKED with FOR UPDATE but not with FOR SHARE - can this also be added as pessimistic_partial_read for FOR SHARE?

The Problem

There is no way to specify FOR SHARE SKIP LOCKED

The Solution

Add a new mode for setLock pessimistic_partial_read that is only supported by Postgres (similar to #5927) that translates to FOR SHARE SKIP LOCKED

Considered Alternatives

Additional Context

we currently work around this with the following hack:

		const [sql, params] = query.getQueryAndParameters();
		const fullSql = `${sql} SKIP LOCKED`;
		const result = await entityManager.query(fullSql, params);

and then using the strategy here to map the results to an entity

Relevant Database Driver(s)

DB Type Relevant
aurora-mysql no
aurora-postgres no
better-sqlite3 no
cockroachdb no
cordova no
expo no
mongodb no
mysql no
nativescript no
oracle no
postgres yes
react-native no
sap no
spanner no
sqlite no
sqlite-abstract no
sqljs no
sqlserver no

Are you willing to resolve this issue by submitting a Pull Request?

  • ✖️ Yes, I have the time, and I know how to start.
  • ✖️ Yes, I have the time, but I don't know how to start. I would need guidance.
  • ✖️ No, I don’t have the time, but I can support (using donations) development.
  • ✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
  • ✅ Maybe, will try to see if I have some time soon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@matgr1 and others