pgsql: Assert no duplicate keys in shm_toc_insert()

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Assert no duplicate keys in shm_toc_insert()
Date: 2026-04-06 22:42:53
Message-ID: E1w9sei-003Iey-1T@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Assert no duplicate keys in shm_toc_insert()

shm_toc_insert() silently accepts duplicate keys. Since shm_toc_lookup()
returns the first matching entry, any later entry with the same key
would be unreachable. Add an assertion to catch this.

Author: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/43222b8e53f49f2cf0849947a02c6fbd74899332

Modified Files
--------------
src/backend/storage/ipc/shm_toc.c | 7 +++++++
1 file changed, 7 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Melanie Plageman 2026-04-06 23:14:53 pgsql: Allocate separate DSM chunk for parallel Index[Only]Scan instrum
Previous Message Nathan Bossart 2026-04-06 21:58:03 pgsql: Add pg_stat_autovacuum_scores system view.