---
id: "CVE-2026-116312"
page: "https://infrastack.ai/live/CVE-2026-116312"
kind: "vulnerability"
aliases: ["CVE-2026-116312"]
title: "PostgreSQL: MERGE on partitioned tables lets an AFTER trigger read the wrong row"
severity: "medium"
cvss: 5.4
epss: null
exploited: false
status: "open"
category: "runtime"
products: []
ecosystems: []
tags: ["database", "postgresql", "runtime", "self-hosted"]
not_affected_if: ["no-after-triggers", "no-partitioned-merge", "postgresql-before-15"]
published_at: "2026-11-12T15:17:39+00:00"
first_seen_at: "2026-11-12T15:41:54+00:00"
updated_at: "2026-11-12T15:43:54+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-116312", "first_seen_at": "2026-11-12T15:41:54+00:00"}]
exploit_sources: []
---

# PostgreSQL: MERGE on partitioned tables lets an AFTER trigger read the wrong row

Link for people: https://infrastack.ai/live/CVE-2026-116312 (this .md is for agents)

A bug in how PostgreSQL's MERGE command tracks transition capture on partitioned tables can make an AFTER trigger process the wrong new row. A user who can modify table data can use a MERGE that runs an INSERT before an UPDATE to make the trigger act on unintended data.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Run `SELECT version();` in psql and compare the server version with the fixed releases.
- Check whether any AFTER triggers use transition tables and whether MERGE runs against partitioned tables.

## Fix

- PostgreSQL `18.7`
- PostgreSQL `17.12`
- PostgreSQL `16.16`
- PostgreSQL `15.20`

## Timeline

- 2026-11-12T15:41:54+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-116312

## From the sources

Inconsistent transition-capture state in PostgreSQL MERGE allows a table data modifier to make an AFTER trigger process the wrong new row, via a partitioned table MERGE that performs an INSERT before an UPDATE.  Within major versions 15-18, minor versions before PostgreSQL 18.7, 17.12, 16.16, and 15.20 are affected.  Versions before PostgreSQL 15 are unaffected.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
