Postgres is an extensible platform, not just a database. I’ve been cooking this year on a side project with Postgres extensions and Kubernetes – finally ready to share what I’ve built.
The CNPG Extensions Catalog is over a hundred extension images for CloudNativePG with inspectable SBOMs, rapid updates (driven by renovate with automerge when tests pass), a framework for building extensions from source when it makes sense, and a website to browse the catalog.
https://cnpg-extensions.github.io
Before we get into the controversial bits, here’s a 5-minute intro. Some history of extensions on kubernetes, licensing reasons for an independent project, a demo of catalog install and automated upgrades.
Background Reading
The best general collection of links I’ve seen is [the PGXN_v2 page on the Postgres wiki] – especially the blog posts, presentations and ecosystem summit.
Abigale Kim’s VLDB publication deserves a special callout: [Anarchy in the Database: A Survey and Evaluation of Database Management System Extensibility]
A few recent blogs give additional perspective:
- Craig Kerstiens wrote a blog back in 2024 about the central role of extensibility in [The future of Postgres?]
- Grant Fritchey published a good piece on the RedGate blog a few weeks ago [PostgreSQL extensions: why the FUD is wrong]
- Just yesterday, Ludovico Caldara published a thought-provoking blog [Database extensions and dependencies: who owns the complexity]
Controversial Bits
First, it’s important to understand how the versioning works. You choose the Postgres Major Version (18 or 19) and the Debian Base Image (trixie or bookworm). You receive updates only within your Postgres and Debian version. Remember to check for locale/collation changes when switching to a different Debian base image. (And set your database default to Postgres builtin collation!)
Topic 1: Are unattended upgrades safe? Or are they too risky?
People generally agree on the importance of staying up-to-date. The official Debian Reference Manual says: “If the risk of breaking an existing stable system by the automatic upgrade is smaller than that of the system broken by the intruder using its security hole which has been closed by the security update, you should consider using this automatic upgrade.” The official Postgres Versioning Policy doesn’t comment on automatic upgrade but it does talk about the importance of updates: “The community considers performing minor upgrades to be less risky than continuing to run an old minor version.”
The debate is around what the update process should look like. What level of testing is needed? What should be automated? How should database maintenance be staffed? Should dedicated DBAs be hired at all? Should one person be able to keep hundreds or thousands of databases updated?
Extensions vary widely, applications vary widely, and people vary widely. There’s not a single right answer here and the system needs to accommodate many approaches.
But something I think about a lot is defaults and whether behaviors are opt-in or opt-out. I wrote the CNPG Extensions website with a pretty clear default recommendation for automatic unattended upgrades.
Of course, many people will do it differently. It’s easy to update test environments first, and update production environments later. A second CronJob with a slight tweak could update a separate catalog for upper/prod environments by copying the catalog used for the previous week’s lower/test environment, rather than sourcing the CNPG Extensions Catalog directly. Or forget the CronJob and pin extensions from the CNPG Extensions Catalog by the digest. (Get the digest from the versions tab on the website – but then it’s your job to stay on top of regularly updating the digests by hand.) Or use dependabot or renovate to drive your extension updates based on passing tests.
My main opinion is that security posture is more important today than ever before. I’m biased toward automated updates with passing tests. I like the example of dependabot or renovate, automerging dependency updates after tests pass – I think the same approach can be used for extension and postgres minor updates.
And don’t overthink the tests. I think it’s fine to start with basic smoke tests, and continue to update them as you learn more. You don’t need perfection on day one; the code can continue evolving after release.
Topic 2: Older/multiple SQL versions with a single (latest) container image?
The SQL version of the extension should match the latest SQL version supported by the image (the default version in the control file).
The idea of supporting older/multiple versions is appealing. But this is less reliable than people realize. It’s up to extension authors to ensure compatibility at the shared object layer across versions, and things break more easily than you’d expect. Also, extension authors sometimes connect the shared object filename to the version – which would mean older function signatures look for a file which doesn’t exist at all (unless we build and bundle multiple versions in the image).
Looking across the 103 extensions currently in the catalog, there are 5 extensions where the shared-object-file name can change, causing complete failure with an old extension SQL version: timescale, mobilitydb, pgrouting, postgis and pointcloud.
And I haven’t vetted everything but a pass with an agent found 33 more extensions where errors are possible using old function signatures against a newer shared object file despite the correct filename: pg-parquet, age, pgsentinel, documentdb, pg-backgound, pg-search, pglinter, pg-textsearch, roaringbitmap, pg-duckdb, PostgreSQL Anonymizer, pg-session-jwt, pg-rewrite, show-plans, pg-squeeze, orafce, H3, pgnodemx, pg-cron, pglogical, q3c, plprofiler, plpgsql-check, icu-ext, pg-wait-sampling, HypoPG, pg-qualstats, pg-stat-kcache, http, pg-rrule, pg-repack, pgmemcache and pgfincore.
I think it’s pretty clear that the best default behavior is for SQL version to match the image version.
Topic 3: Downgrade/Rollback
Rollback the image version to the old digest at the same time as restoring a backup or deleting & re-installing the extension. I actually think downgrades are usually the wrong thing to do, but it’s fairly straightforward or those who want the option. (Your job is to make sure the downgrade is safe with regard to anything persistent that’s been touched by the newer version.)
Try It Out
Let me know what you think of the CNPG Extensions Catalog! Please give this a try and tell me if things don’t work. I’m sure that the website will need some clarifications, extension build recipes might need tweaking, and extension README’s will need clarifications. There will be plenty of fixes and updates over time.
I hope this will be useful, I hope it will increase access to the Postgres ecosystem on Kubernetes, and I hope it’ll make it easy and automated for many non-Postgres people.



Discussion
No comments yet.