Skip to content

Add support for postgres advisory locks#1062

Open
NeelChotai wants to merge 3 commits intoSeaQL:masterfrom
NeelChotai:neel/pg-advisory-locks
Open

Add support for postgres advisory locks#1062
NeelChotai wants to merge 3 commits intoSeaQL:masterfrom
NeelChotai:neel/pg-advisory-locks

Conversation

@NeelChotai
Copy link

@NeelChotai NeelChotai commented Mar 23, 2026

PR Info

This PR adds support for Postgres advisory locks: https://www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS

I was considering just adding one advisory_lock function, and instead having:

pub enum PgFunc {
...
  AdvisoryLock(AdvisoryLock)
}

pub enum AdvisoryLock {
    AdvisoryLock,
    AdvisoryLockShared,
    TryAdvisoryLock,
    TryAdvisoryLockShared,
    AdvisoryUnlock,
    AdvisoryUnlockShared,
    AdvisoryUnlockAll,
    AdvisoryXactLock,
    AdvisoryXactLockShared,
    TryAdvisoryXactLock,
    TryAdvisoryXactLockShared,
}

However this felt a bit messy, and breaking with current conventions.

New Features

  • Support for Postgres advisory locks

Bug Fixes

Breaking Changes

Changes

@Huliiiiii Huliiiiii requested review from Expurple and tyt2y3 March 23, 2026 12:09
@Huliiiiii
Copy link
Member

I did some refactor in #1063. Now FunctionCall::new accepts Into, so you can simplify the code a bit.

@NeelChotai NeelChotai force-pushed the neel/pg-advisory-locks branch from 608ad6e to a94d502 Compare March 23, 2026 12:47
@NeelChotai
Copy link
Author

I did some refactor in #1063. Now FunctionCall::new accepts Into, so you can simplify the code a bit.

updated!

@NeelChotai NeelChotai force-pushed the neel/pg-advisory-locks branch 2 times, most recently from b731a0e to 66745a3 Compare March 23, 2026 12:56
@Huliiiiii
Copy link
Member

You can just use FunctionCall::new(PgFunc::...).

@NeelChotai NeelChotai force-pushed the neel/pg-advisory-locks branch from 66745a3 to 50f4e77 Compare March 23, 2026 13:06
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