jackc / jackc/tern

[Question] pg_advisory_lock not supported by CockroachDB

Open
#35 22 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.3k
Forks
86
PR merge metrics
No merged PRs in 30d

Description

Greetings,

This is my favorite migration tool. However, I just started a new project with CockroachDB, and on migration I get a warning
```
Error initializing migrator:
ERROR: unknown function: pg_advisory_lock() (SQLSTATE 42883)
```
It looks like there are a [couple places](https://github.com/jackc/tern/blob/073150ed15213725dc32e87a0c37fe8c28d876d7/migrate/migrate.go#L273) where the function is used in migrate.go. Is it your opinion that this lock function is critical to the library? It seems like cockroach always uses `SERIALIZABLE isolation`.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in migrate/migrate.go at the pg_advisory_lock calls around the migration initialization path. Read how the lock is acquired and released, then compare that behavior with CockroachDB's serializable transactions and the reported unknown-function error. Done means the project has a decided and tested compatibility approach for CockroachDB.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.