Writing a Postgres extension in Rust with pgrx is a lot of fun. You write a few functions in Rust, launch an instance with cargo pgrx run and you can call these functions directly inside Postgres.
With cargo pgrx test and cargo pgrx regress, you can run unit tests and regression checks against any major version of Postgres until everything is green. Then comes the last step, and it’s the least fun one: shipping it.
Shipping a PostgreSQL means packages. A lot of packages. One for each distro (RPM/DEB), for each Postgres Major versions and for each CPU architecture. For instance with the PostgreSQL Anonymizer extension, we publish 24 packages for every release…
Until now, the cargo pgrx package command gave you a nice directory tree and politely wished you good luck with the rest. With pgrx 0.20, that last step is gone. :-)
But before jumping into that, follow me in a quick overwiew of the new features of PGRX 0.20 which was released a few days ago !
This is a big release, with some breaking changes. Here are the highlights:
cargo pgrx migrate: assemble your upgrade scripts from small SQL fragments, one file per change.
cargo-pgrx itself compile fewer crates, and installing cargo-pgrx on Linux no longer requires the OpenSSL headers.
On Linux, cargo pgrx package can now build RPM and DEB files directly:
debian/ folder
A test says what its author expected. When the author also wrote the code, both come from the same reading of the problem, and a mistake in that reading is in both. They agree, the test passes, and the bug ships. Below is one way out of that loop for code whose answers can be computed another way: write a second implementation that is slow and plain, and compare the two on inputs neither author chose. It covers what that comparison found in a policy compiler, what it missed, and why the second implementation needs checks of its own.
The code here is a compiler. It reads a short policy ("you may view a folder if it is shared with you, or if you may view its parent") and writes PostgreSQL: views, row-level security policies, closure tables kept current by triggers, functions for single-row checks. That output is built for speed. Inheritance is not walked at query time; a table holds every ancestor of every folder, and triggers move its rows when a folder moves. Each permission can be computed two ways: as a set of ids, for lists, and as a check of one row, for writes. A lookup that another part of the permission already covers is left out.
Each of those choices is a place for a mistake. A closure row not moved on an edge case is a folder someone sees after it moved away. The fast path for lists and the fast path for one row can disagree. A test written against any of them is written by someone who knows what the optimisation was meant to do, and checks that.
The reference evaluator answers the same question with none of those choices. It reads the policy as parsed, not the compiler's model of it, and works on sets of ids in memory. Each relation is a set; each permission is computed from the sets it names. Inheritance is a loop that adds what it finds until nothing changes, a least fixed point. For the folder policy and one user, it comes down to this:
# can view = viewer or parent.view, for one user, as sets of ids
parent = {2: 1, 3: 2, 4: 3,
On a single Postgres server, primary keys stay unique because only one sequence hands out the numbers: a bigint identity column asks it for the next one, and no two rows ever get the same. Now put writers in several regions, each of them accepting inserts while the links between them are slow or down. Two regions that each ask their own sequence for “the next number” will hand out the same one, and the first time those two rows meet on a subscriber, one of them is rejected.
So which primary key should we give a table that several regions write at the same time? That’s the question of this article. It continues the logical replication series: Part 1 listed the ways to make ids that can’t collide, and Part 4 built the system that uses them, with a group of nodes in each region and every region subscribed to the others. Here we measure what each choice costs on the same workload: in size, in WAL, in joins, during failovers, and when clocks disagree.
We take the basics for granted. A primary key is a unique and non-null constraint. A generated id is a surrogate key, and it doesn’t replace the natural key, because it can’t stop two rows that describe the same thing. Database Normalization and Primary Keys covers both, and this article is about where the generated id comes from.
TL;DR We compared five primary keys for a table that several regions write at once. A sequence per region is the trap: when a region’s standby is promoted, the sequence can hand out numbers that were already used. uuidv7() is cheap and needs no coordination. A composite (region, id) key lets a publication filter on the region without a second index. A bigint made of a timestamp, the region and a counter does the same with a single column, as long as the clocks agree. And whatever the key, 32 bits is a wall.
Autumn is the time when leaves change color and fall. It’s also the time when new PostgreSQL releases come out, or at least that’s been the tradition for quite a while.
There’s one more thing that autumn brings to the PostgreSQL world: PGConf.EU, the annual conference that has grown into the largest PostgreSQL community event.
This year we met in Valencia, Spain. And while I’ve attended several editions already, 2026 brought quite a few firsts for me.
Running PostgreSQL in Docker takes ten seconds to start in development — and about ten minutes to lose data in production if you copy a default compose.yaml snippet from a tutorial.
Most outages with containerized Postgres are not caused by Docker itself. They happen because Docker’s defaults (64 MB /dev/shm, a 10-second SIGKILL timeout, unpinned :latest tags, and outdated PGDATA volume paths) collide directly with how PostgreSQL manages memory, checkpoints, and disk files.
The short checklist. Mount PG 18+ volumes at
/var/lib/postgresql(not/data), setshm_size: 1gb+, setstop_grace_period: 60s, enable--data-checksums, put PgBouncer in front of bursts, and never expose port5432on0.0.0.0.
PGDATA Mount Path
If you upgrade an older Docker Compose stack to PostgreSQL 18 or newer, the very first trap is structural.
Per the official Docker Hub postgres image documentation:
PGDATA defaulted to /var/lib/postgresql/data, and Compose files mounted volumes to /var/lib/postgresql/data.
PGDATA moved into version-specific subdirectories (/var/lib/postgresql/18/docker, and /19/docker for v19), and the official VOLUME target changed to /var/lib/postgresql.
Why did the maintainers make this breaking change? It aligns the container layout with Debian’s pg_ctlcluster convention so pg_upgrade --link can upgrade major versions cleanly inside the same parent directory in the future.
Ollama is popular because it makes running large language models (LLMs) locally simple, private, and inexpensive. DBeaver 26.2.5, also free & open-source, recently added support for Ollama. And both pair well with PostgreSQL.
Runs AI Locally — Execute models such as Llama, Qwen, Gemma, and DeepSeek on your own computer without relying on cloud services.
Privacy and Data Control — Prompts and data can remain entirely on your machine, making Ollama attractive for sensitive business information and internal applications.
Free and Open Source — Ollama is free to use locally, with no per-token API charges. Individual models have their own licenses.
Easy Installation — Download and run models with simple commands:
ollama run llama3.2
Developer-Friendly API — Provides a local REST API compatible with many AI development tools, making integration with Python, applications, and databases straightforward.
Broad Model Support — Supports numerous open-weight models, allowing developers to experiment with different capabilities, sizes, and performance characteristics.
Works Offline — Once models are downloaded, inference can run without an internet connection.
Hardware Flexibility — Runs on macOS, Linux, and Windows, supporting CPU inference and GPU acceleration on compatible hardware.
Ollama removes much of the complexity traditionally associated with deploying LLMs. Developers can prototype AI applications, build RAG systems, experiment with AI agents, and implement natural-language-to-SQL interfaces without managing complicated inference infrastructure.
Ollama has become popular because it makes local AI accessible. It provides a straightforward way to download, run, and integrate powerful language models while retaining control over data, i
[...]I’ve made three new GitHub actions in the past few months to replace the venerable Docker-based pgxn/pgxn-tools, which has become bloated and requires more work to maintain than I’d like. The new actions require much less maintenance, support all GitHub runner OSes and architectures, and run more quickly. What they do:
Starting simple, here’s how to use the release action:
name: 🚀 Release
on:
push:
jobs:
release:
name: Release on PGXN
runs-on: ubuntu-latest
steps:
uses: actions/checkout@v7
uses: pgxn/release-action@v0
with:
username: ${{ secrets.PGXN_USERNAME }}
password: ${{ secrets.PGXN_PASSWORD }}
dry-run: ${{ !startsWith( github.ref, 'refs/tags/v' ) }}
Yep, that’s it. The pgxn/release-action action will use git archive to create a PGXN bundle and release it on PGXN. (Want to omit some files, such as GitHub workflows, from the release? Use gitattributes to exclude them!) The value passed for the dry-run option prevents publishing the bundle on PGXN except when pushing a Git tag starting with v.
The action also outputs the archive name, so you can use it elsewhere, such as a GitHub release on the last line of this workflow:
name: 🚀 Release
on:
push:
jobs:
release:
name: Release on GitHub and PGXN
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v7
- name: Release on PGXN
uses: pgxn/release-action@v0
id: pgxn
with:
username: ${{ secrets.PGXN_USERNAME }}
password: ${{ secrets.PGXN_PASSWORD }}
dry-run: ${{ !startsWith( github.ref, 'refs/tags/v' ) }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
if: startsWith( github.ref, 'rJust a short & quick follow-up to [yesterdays blog] before I run out the door.
I hadn’t been paying attention, and yesterday’s postgres release had a few surprises for me. I’m catching up now.
First: read [Devrim’s blog] and [Lukas’ 5-minutes-of-postgres] for the TLDR.
Second: I had this in yesterday’s blog – “RPM packaging now adds a header to require a specific minor. I haven’t checked Debian ecosystem yet but it might also be addressing this.”
I took a quick look this morning, and Debian packaging does have the same protection.
This matters because lots of people won’t upgrade Postgres today (even though we tell them to). Next week they will try to install some new extension, and their OS packager will try to pull the latest version. Devrim and Christoph (two of our primary Postgres packagers
) have ensured that the packaging systems will protect you from a bad installation.
On Debian:
apt-mark hold postgresql-18
apt-get install -y postgresql-18-cron
Key output (installation fails):
postgres (PostgreSQL) 18.6 (Debian 18.6-1.pgdg12+2)
postgresql-18-cron : Depends: postgresql-18 (> 18.7) but 18.6-1.pgdg12+2 is to be installed
E: Unable to correct problems, you have held broken packages.
...
Allow upgrades:
apt-mark unhold postgresql-18
apt-get install -y postgresql-18-cron
postgres --version
Key output:
The following packages will be upgraded:
libpq5 postgresql-18 postgresql-18-jit postgresql-client-18
Setting up postgresql-18 (18.7-1.pgdg12+2) ...
Setting up postgresql-18-cron (1.6.8-1.pgdg12+3) ...
...
Package metadata:
apt-cache show postgresql-18-cron
Key output for selected candidate:
Version: 1.6.8-1.pgdg12+3
Depends: postgresql-18 (>> 18.7), libc6 (>= 2.14), libpq5 (>= 9.0~)
On Rocky:
Try unversioned extension installation with PostgreSQL upgrades blocked:
dnf install -y --exclude='postgresql18*' pg_cron_18
Key output (installation fails):
Problem: package pg_cron_18-1.6.8-4PGDG.rhel9.8.x86_64 from pgdg18 requires postgresql18-libs(x86-64) >= 18.7, but pgxs_extensions hash in the.pm file. The existing BlackholeFDW, FileTextArrayFDWUNRELEASED and HEAD_PLUS_UNRELEASED,locales entries can now be a hashref naming both the locale and the{ locale => 'C', encoding => 'UTF8' }. Encodings areimport-series.pl driver when present, so the farm tests exactly what agit apply rather thangit quiltimport, at full context.
../master/foo.patch) changes.
PGBuild::PatchSeries module for shared series reading, and a newcheck_patch_stack.pl script to check a patch stack.
patch_stack.log for distinct display on the server.
diagnose => 1).
git am state left behind by a failed or killed run, whichPostgres API and ABI stability has been a topic of discussion for a long time. To understand why this matters so much, start with Dave Stokes recent blog post [Is PostgreSQL Really Winning Part 2: The Evidence Beyond the Rankings]. It’s fundamentally about “a slow core with a fast edge is a pretty good design” and how the Postgres extension API enables an amazing ecosystem around Postgres.
The official postgres docs have [guidance on API/ABI stability], and for a bit of extra background check out [David Wheeler’s 2024 post-pgconf blog], and EnterpriseDB’s [explainer about the Postgres 17.1 ABI breakage].
The postgres community works really hard not to break ABI compatability because it means that a bunch of extensions won’t interoperate between minors. But sadly this was another of the rare cases where it was needed… this time as a result of CVE-2026-6460 (just one of many CVEs in the GIANT stack that 18.7 contains).
It’s explicit in the release notes and it’s the very first bullet point. https://www.postgresql.org/docs/release/18.7
Introduce versioning logic to permit detection of composite datums that don’t match the tuple descriptor we wish to interpret them with. For full protection, this change requires rebuilding C-language extensions, and there are some extensions that will require source-code changes. If necessary, the new composite_type_mismatch server parameter can be used to disable these checks, but doing so carries security risks.
This will be a pain for Postgres users. It means that extensions (which are packaged and distributed separately) need to be upgraded exactly in lockstep with the Postgres minor bugfix update itself.
One very unfortunate side-effect of the Postgres model: Postgres 18.7 has important CVE fixes – but people using extensions cannot upgrade to 18.7 and get those CVE fixes until their extensions are also updated and have released new extension versions.
I’m doing a lot of work around extensions for CloudNativePG on Kubernetes and I saw a lot of my
[...]Last month, the Apache Software Foundation's Community Over Code came to Scotland 🏴, taking place from October 11th to 14th at the Hilton Glasgow. Even though I've been in the open source world for 25+ years, this was my first Community Over Code (!), and I loved it: great talks, an amazing hallway track with Apache community rockstars, and a Community track that I very much enjoyed. I also came away convinced that there is huge potential for synergy between the Apache data ecosystem and the PostgreSQL community.
Many thanks to the ASF and everyone who made Community Over Code Glasgow 2026 possible.
ColdFront didn't exist yet when the Call for Presentations closed, so I submitted it as a lightning talk at the last minute. On Wednesday, October 14th, I had the pleasure of presenting ColdFront: Transparent PostgreSQL Tiering to Iceberg. It was also my first lightning talk under these rules: five minutes, no laptop, no slides! Many thanks to Ruth Suehle and Brian Proffitt of the ASF for hosting.
ColdFront is one example of that synergy: it moves data from PostgreSQL to Apache Iceberg transparently, so your application keeps using plain PostgreSQL. We covered:
UPDATE, MERGE, ALTER TABLE and everything else you would expect, that successfully runs all 99 queries of TPC-DS.
The rec
[...]
PostgreSQL 18.7, 17.12, 16.16, 15.20 and 14.25 are out today. If you use the PGDG RPM repositories (yum.postgresql.org or zypp.postgresql.org), please update PostgreSQL and all of your extensions in the same transaction this time. Do not update the server today and the extensions next month, and do not hold one back while the other moves.
This release is different from a usual minor release. It contains the fix for CVE-2026-6460, and that fix reaches into the extensions too. So we rebuilt every extension in the repositories against the new minor releases. That covers every package built separately for each PostgreSQL version, on all supported RHEL / Rocky Linux / AlmaLinux, Fedora, Amazon Linux, SLES and openSUSE Leap versions. The rebuilt packages are released together with the new minors.
The CVE-2026-6460 fix (commit 245eb832f) adds versions for composite types. It changes how composite values are stored, and it changes the server's interface to extensions in two ways:
DatumGetHeapTupleHeader() used to be a macro. It is now a function in the server.
heap_getattr() now calls the new heap_datum_check().
The headers are compiled into the extension, so this affects both directions:
So a new server needs new extensions to be safe, and the new extensions need a new server to load at all. That is why they have to be updated together.
Until now, an extension package only required the PostgreSQL major version. From these rebuilds on, every co
[...]In today’s E123 of “5mins of Postgres” we’re talking about the Postgres 18.7, 17.12, 16.16, 15.20 and 14.25 minor releases that were released today, which fix 52 security vulnerabilities and other bugs in Postgres. In this episode we focus on the security impact of the release, but the release also contains other important fixes.
To help you assess when you should upgrade your system we group the CVEs by what an attacker needs to exploit them, take a closer look at CVE-2026-6460 and its unusually invasive fix, and discuss why this minor release can break extensions and needs extra care when you update your packages.
The quick TLDR: If you’re currently running Postgres and you allow arbitrary SQL to be executed in some way (or SQL injection is a potential concern), you should update to this release. There is a risk that any user who can execute SQL in your database could ultimately become an OS user or the Postgres superuser because of these vulnerabilities.
Share this episode: Click here to share this episode on LinkedIn. Feel free to sign up for our newsletter and subscribe to our YouTube channel.
Build Vercel Cron Jobs in Next.js with CRON_SECRET, PostgreSQL locks, bounded backfill, safe retries, and a practical production debugging guide.
Your daily report runs at 02:00 UTC. One morning it never reaches the app. The following day it arrives twice, and both invocations try to produce the same report. A route that processes “today” on each request skips the missing day and may repeat yesterday’s work. The fix is to record which days are due and which were completed in PostgreSQL.
This guide builds a Next.js cron endpoint that queues each closed reporting day once, catches up after missed invocations, and can resume after a crash. The example writes daily event counts to PostgreSQL. A later section explains what changes when a job sends email or calls an external API.
Vercel Cron Jobs invoke a production route with an HTTP GET on a UTC schedule. Put the configuration in the root directory of the Vercel project. In a monorepo, that is the configured app root, which may differ from the repository root. This example schedules 02:00 UTC daily; the plan limits list minimum intervals and timing precision. A Hobby job may run within the scheduled hour, so do not depend on an exact minute.
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"crons": [
{
"path": "/api/cron/daily-report",
"schedule": "0 2 * * *"
}
]
}
Set a random CRON_SECRET in Production. Vercel sends it as a Bearer token. Fail closed if the variable is missing, and never log the header. The cron management docs explain how deployed environment values, rotations, and rollbacks interact. After changing the value, deploy and verify the next invocation.
A request that reaches the route is a wake-up signal. It can be late, duplicated, or absent; Vercel does not retry a failed cron invocation. The delivery guidance recommends reconciliation. Keep the schedule as a trigger and put the actual reporting state in the database.
Build PostgreSQL vector search with pgvector and Next.js. Compare keyword and hybrid ranking, enforce tenant access, and reproduce filtered HNSW recall.
A support engineer searches for AUTH-4017. The most useful result is the ticket with that exact error code. Another engineer types “sign-in works until I close the browser” and wants the ticket about a session cookie disappearing on restart. These queries need different kinds of evidence. A useful search feature can combine both without sending the entire support archive to a model.
This guide builds keyword, vector, and hybrid retrieval in PostgreSQL, then connects the query to a Next.js Route Handler. The lab uses fixed, three-dimensional vectors so you can reproduce the ranking and filtering behavior without an embedding API key. Those numbers stand in for embeddings; they do not measure an embedding model’s understanding of support tickets.
Use a disposable PostgreSQL database with pgvector 0.8 or newer. A provider that supports the extension or a local image from the pgvector project works. The extension and schema setup require a migration role; the search route will use a separate, restricted login.
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE support_ticket (
id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
tenant_id text NOT NULL,
error_code text,
title text NOT NULL,
body text NOT NULL,
embedding vector(3) NOT NULL,
search_text tsvector GENERATED ALWAYS AS (
setweight(to_tsvector('english', title), 'A') ||
setweight(to_tsvector('english', body), 'B')
) STORED
);
CREATE INDEX ticket_tenant_idx ON support_ticket (tenant_id);
CREATE INDEX ticket_code_idx ON support_ticket (tenant_id, error_code);
CREATE INDEX ticket_fts_idx ON support_ticket USING gin (search_text);
INSERT INTO support_ticket (tenant_id, error_code, title, body, embedding)
VALUES
('acme', 'AUTH-4017', 'AUTH-4017: OAuth callback failed',
'Verify the redirect URI re[...]
A PostgreSQL database holds logic as well as data, in functions, triggers and Row-Level Security (RLS) policies. On Supabase and Neon much of that logic can be reached straight from the browser. UnitAutogen for PostgreSQL generates three kinds of test for it, together with the mock data each test needs, so nothing is written by hand.
So far, the storage internals series has focused on heap pages. We began by opening the 8KB page, then traced MVCC visibility through xmin, xmax, and snapshots. Next we observed HOT updates evade index maintenance, and finally tracked VACUUM as it went through its phases. Each time an index came up, the explanation stopped at either "the index points to the heap via ctid" or "index cleanup removes the dead entries". This chapter is about what lies at the other end of that pointer.
B-tree pages use the same 8KB skeleton (24-byte header, line pointers, tuples packed from the bottom up), but where a heap page is an unordered bag of row versions, a B-tree page is sorted and linked to its siblings at the same level. VACUUM cannot undo index bloat for that reason; the operational side of this issue is covered in VACUUM Is a Lie. Index bloat is a recurring topic and source of question during my talk "Postgres Storage Internals Visualized", and this is my attempt to address it better.
We need pageinspect for reading raw B-tree pages and pgstattuple for index-level statistics. By default, both require a superuser, but on managed instance, only pgstattuple can be granted because pageinspect checks for a superuser inside every function. All of the following was captured on PostgreSQL 18.6 (the postgres:18 image) in a single session; page numbers and item counts are from that run.
CREATE EXTENSION IF NOT EXISTS pageinspect;
CREATE EXTENSION IF NOT EXISTS pgstattuple;
CREATE TABLE idx_demo (
id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
value integer NOT NULL
);
INSERT INTO idx_d[...]
On 4th of November, 2026, we had the PostgreSQL November Meetup in Berlin. AWS hosted it again, this time we had two speakers from Germany and UK.
The Meetup took place in the Amazontower (EDGE East Side Tower Berlin) in Berlin, across the Uber Arena and right next to the East Side Mall.
Oleksii opened the Meetup with a few general notes
Number of posts in the past two months
Number of posts in the past two months
Get in touch with the Planet PostgreSQL administrators at planet at postgresql.org.