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.
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:
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?
Continue reading
Recent Comments