Skip to content

Conversation

@chumaltd
Copy link
Contributor

Hi, I just implemented more accurate extension detection logic.

PostgreSQL's oid is not globally unique, and you need to search both with its own oid and oid of its object class.
I hit into a conflict case between my table oid & extension's function oid.

Past releases of psqldef after e57a042 can eventually see this issue after long run with extensions.

I just confirmed go test finished successfully under cmd/psqldef.
I'm sure this patch fits original intension of e57a042, but I have no ideas about:

  • pg_type may require handling pg_enum, too. But WHERE relname IN ('pg_type', 'pg_enum') will be still ambiguous between their combinations. I took just mitigation at this point.
  • We don't have corresponding test cases simulating oid confliction.

I can test with my production DBs when #1060 quick solution will be landed.

@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
database/postgres/database.go 81.92% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gfx
Copy link
Contributor

gfx commented Dec 17, 2025

Thanks!

Would be nice if we have at least one test case for this, but for now, I'm merging this PR and will immediately release a new version of sqldef.

@gfx gfx added this pull request to the merge queue Dec 17, 2025
@gfx gfx added the psqldef Bugs or feature requests related to PostgreSQL label Dec 17, 2025
@gfx gfx changed the title Fix handling duplicated PostgreSQL OID from extension psqldef: Fix handling duplicated PostgreSQL OID from extension Dec 17, 2025
Merged via the queue into sqldef:master with commit 0945a54 Dec 17, 2025
26 checks passed
@sqldef-bot sqldef-bot bot mentioned this pull request Dec 17, 2025
gfx added a commit that referenced this pull request Dec 17, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 18, 2025
* add regression tests for #1061

* fix tests (the tests run in parallel => rase)
@sqldef-bot sqldef-bot bot mentioned this pull request Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

psqldef Bugs or feature requests related to PostgreSQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants