76techs / Blog

The PostgreSQL patch that calls for an index and backup review

|

After the November 12 updates, verify versions, rebuild affected indexes, and prove restore from a fresh native backup chain.

Suppose your team patched PostgreSQL 17 on Saturday. The connection pool came back, the application passed its tests, and the replica caught up with the primary. On Sunday, the incremental backup job reported success. When someone asks whether you can still restore the database to the end of Saturday, the answer depends on something none of those signals verifies. Which full backup did that incremental rely on, and has anyone restored the chain?

The November 12 update puts that question at the center of the change. The PostgreSQL Global Development Group released 18.7, 17.12, 16.16, 15.20, and 14.25, with fixes for 52 vulnerabilities and more than 140 bugs. Some existing indexes need to be rebuilt, and the project recommends starting a new chain for native incremental backups. Version 14.25 also marked the end of upstream maintenance for PostgreSQL 14.

Which version to record in the inventory

For installations that use upstream binaries, these are the versions released on November 12. PostgreSQL 19 RC 2 shipped alongside them as a release candidate. As of November 17, the project's announced date for general availability was still November 19, provided no issue required a delay.

Release line

Upstream version released

Status after the update

18.x

18.7

Supported

17.x

17.12

Supported

16.x

16.16

Supported

15.x

15.20

Supported

14.x

14.25

Final upstream release

If you install packages from a distribution, check the package revision as well. On November 13, Debian published DSA-6625-1 and identified 17.11-0+deb13u1 as the fixed postgresql-17 package revision for Debian 13. The same notice says some extensions need recompilation for complete protection against CVE-2026-6460. That is how a deployment decision based solely on the version returned by SQL can go wrong. For a managed service, use the provider's advisory and build identifier.

Run this query against the endpoints used for reads and writes. If you connect through a proxy or pool, confirm which instances answered. Record the installed package or build, the inventory of replicas, and the versions of the backup utilities your job uses. The query reports the version of the server that answered that session.

SELECT current_setting('server_version') AS server_version,

pg_is_in_recovery() AS in_recovery,

inet_server_addr() AS server_address;

Where the security fixes change the review

CVE-2026-16237 matters to teams that use updatable views to separate data. The advisory describes an issue that allowed a role with insert and update privileges on a view to reach rows the view's filter should have hidden. Think of an import connector that handles data for several clients and gets write access to a company-specific view. In a test environment with synthetic data, confirm that a visible record can still be updated, that the role still has no direct access to the base table, and that the visibility boundary holds in the import workflow. Run those checks as the application role. A superuser has different privileges from the ones you need to verify.

CVE-2026-6460 involves type confusion and can let someone who can create objects run code as the operating system account used by the database. Review which roles can create or alter objects and check with the maintainers of any C extensions about compatibility with the fixed build. The 18.7 notes say full protection requires rebuilding C extensions, and some need source changes. Keep type checking enabled and work with the vendor on incompatible extensions. For both CVEs, the project identifies the five versions in the table as fixed.

As of November 17, the project advisories reviewed document the flaws and fixes without reporting confirmed exploitation for either CVE. If you see changes inconsistent with the intended visibility rules or schema operations from roles normally used only by the application, compare the events with the audit logs you already have, deployment times, and permission history. Those events give you a place to start an investigation. While waiting for deployment, consider pausing imports that write through those views and limiting object creation to roles that need it. Record which operations are paused and when they will resume.

The patched server still reads old indexes

The project recommends rebuilding existing GiST indexes that use the gist_trgm_ops operator class from pg_trgm. A search can use that class to order results by distance. In a supplier directory, for example, someone can type an approximate name and get the top ten matches. If the relevant part of the index was affected, swapping the binary still leaves the previously built structure on disk.

To find candidates, this read-only query uses the catalogs of the database you are connected to. It lists physical GiST indexes with an operator class named gist_trgm_ops, largest first. For partitioned tables, it finds the physical indexes on the partitions. Repeat it in each relevant database and confirm the index definition and extension schema before approving maintenance. Size is an inventory measure. It gives no timing estimate.

SELECT ns.nspname AS index_schema, idx.relname AS index_name,

pg_relation_size(idx.oid) AS index_bytes

FROM pg_catalog.pg_index AS ix

JOIN pg_catalog.pg_class AS idx ON idx.oid = ix.indexrelid

JOIN pg_catalog.pg_namespace AS ns ON ns.oid = idx.relnamespace

JOIN pg_catalog.pg_am AS am ON am.oid = idx.relam

WHERE idx.relkind = 'i' AND am.amname = 'gist'

AND EXISTS (

SELECT 1

FROM pg_catalog.pg_opclass AS op

WHERE op.oid = ANY (ix.indclass::oid[])

AND op.opcname = 'gist_trgm_ops'

)

ORDER BY index_bytes DESC;

The announcement's update section lists other cases. The project advises rebuilding GIN indexes suspected of corruption from the bugs fixed in this round. If a table read returns missing chunk number, the announcement recommends rebuilding the table's indexes, including the TOAST index. TOAST stores large values outside the main row. The project also directs users to rebuild B-tree indexes on columns declared as bpchar without a length. Columns declared as char(n) fall outside that specific case. Check the notes for your release line and any intervening updates you skipped.

For an eligible index on a busy table, REINDEX INDEX CONCURRENTLY allows writes to continue, with more work and waiting than a standard rebuild. Watch free space, replica lag, and long-running transactions. The concurrent command must run outside a transaction block, something easy to miss if your migration tool starts a transaction automatically. After the rebuild, test search behavior with a known sample that includes sorting ties. Compare the results with a reference set computed on the same data.

In staging, measure how long the rebuild takes on a table of comparable size, how much extra space it uses, and how long the replica takes to return to its usual lag. For the supplier search, record the returned IDs and p95 latency with the same list of terms before and after maintenance. If a result changes, compare it with the reference ordering. An endpoint can respond normally and still return different candidates.

The full backup that starts the next chain

For teams using native incremental PostgreSQL backups on 17 or 18, the notes recommend a fresh full backup after patching. They say existing incremental backups could be corrupt. Today's incremental can depend on a full backup and earlier incrementals. A successful backup job tells you it reached the end of that run. Recovery still depends on being able to combine and use the chain. For managed snapshots or third-party tools, ask the vendor whether the workflow uses the affected mechanism and follow its documentation.

After updating, take a full backup and record the identifier you will use for subsequent incrementals. Keep the old and new chains distinct in the catalog, preserve the planned retention during the transition, and verify which recovery points remain available. For a native incremental backup, pg_combinebackup reconstructs a full backup from the backups it depends on. pg_verifybackup performs integrity checks on applicable backups, and its documentation recommends a test restore.

In the portal example, restore into an isolated instance. If you use point-in-time recovery, verify that the required WAL files are available and that the server reached the chosen time. Check some orders, permissions, and reports on the restored database. Record the actual recovery point and how long it took for the application to become usable. If the team's targets are to lose at most 15 minutes of data and be back within two hours, the test needs to measure both. Those figures illustrate the test. Use the actual service targets.

How to close the change

On a PostgreSQL 17 cluster, moving from 17.x to 17.12 is a minor update. For an upstream installation, stop the service, replace the binaries within the same release line, and restart. Apply the announcement's additional steps where they fit. For high-availability setups or managed databases, follow your provider's sequence and failover procedures. Confirm the version at every destination and repeat the application operations that use both the read and write endpoints.

On PostgreSQL 14, applying 14.25 covers this round of fixes. Open a separate change to migrate to a maintained release line. Rehearse the environment's chosen major upgrade method, including downtime, extension availability, and your fallback if validation fails. If you manage the upgrade with pg_upgrade, run pg_upgrade --check in the rehearsal and read the target version's documentation.

Close the change with an observed version for each instance, a record of the indexes you reviewed or rebuilt, and, if you use native incrementals, a recovery point restored from the new chain. Keep the extension check results as well. The next time someone asks whether Saturday's backup actually opens, you can point to the result of a restore test.