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

Operator family alterations don't survive cluster upgrades (12->15) #30

Open
process opened this issue Oct 29, 2024 · 0 comments
Open

Comments

@process
Copy link

process commented Oct 29, 2024

When upgrading a cluster from PostgreSQL 12 to 15 using pg_upgrade, the data added via ALTER OPERATOR FAMILY integer_ops is lost. This happens with no warning or error. Easily reproducible with a database that only has CREATE EXTENSION uint;. I'm unsure if this is specific to these versions, or a problem in general with upgrading.

One way to check if a database has been affected is to run \dAp in psql, and then do a / search for btint1uint1cmp. If it's missing, then the operator family information has been lost.

This can be fixed by running psql -f /usr/share/postgresql/{version}/extension/uint--0.sql, or wherever the extension is installed. Definitely not ideal though. All queries in that command will fail except for the two ALTER OPERATOR FAMILY queries near the end.

We discovered this by chance when observing poor query plans when using a uint1 as a partition key on a partitioned table. Queries with where partition_key=1 (for example) would not plan properly, since the = operator was no longer a member of the operator family. (Similar case on SO here, but unrelated to pguint).

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

No branches or pull requests

1 participant