postgresql/src/backend
Tomas Vondra 2fa42feb79 Tighten asserts on ParallelWorkerNumber
The comment about ParallelWorkerNumbr in parallel.c says:

  In parallel workers, it will be set to a value >= 0 and < the number
  of workers before any user code is invoked; each parallel worker will
  get a different parallel worker number.

However asserts in various places collecting instrumentation allowed
(ParallelWorkerNumber == num_workers). That would be a bug, as the value
is used as index into an array with num_workers entries.

Fixed by adjusting the asserts accordingly. Backpatch to all supported
versions.

Discussion: https://postgr.es/m/5db067a1-2cdf-4afb-a577-a04f30b69167@vondra.me
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Backpatch-through: 14
2026-03-14 15:30:05 +01:00
..
access Use GetXLogInsertEndRecPtr in gistGetFakeLSN 2026-03-13 23:26:15 +01:00
archive Fix memory leaks in error reporting with LOG level 2024-05-14 10:41:32 +02:00
backup Fix incorrect errno in OpenWalSummaryFile() 2026-02-03 11:25:16 +09:00
bootstrap Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
catalog Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
commands Don't malloc(0) in EventTriggerCollectAlterTSConfig 2026-03-04 15:04:53 +01:00
executor Tighten asserts on ParallelWorkerNumber 2026-03-14 15:30:05 +01:00
foreign Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:30 -07:00
jit Use CXXFLAGS instead of CFLAGS for linking C++ code 2026-02-26 12:06:58 -05:00
lib Accommodate very large dshash tables. 2024-12-17 15:24:45 -06:00
libpq Fix build breakage on Solaris-alikes with late-model GCC. 2025-07-23 15:44:29 -04:00
main Avoid possible crash within libsanitizer. 2025-11-05 11:09:30 -05:00
nodes Fix internal error from CollateExpr in SQL/JSON DEFAULT expressions 2025-10-09 01:07:36 -04:00
optimizer Fix computation of varnullingrels when translating appendrel Var 2026-02-20 18:01:56 +09:00
parser Fix possible incorrect column reference in ERROR message 2026-01-09 11:03:24 +13:00
partitioning Revert support for ALTER TABLE ... MERGE/SPLIT PARTITION(S) commands 2024-08-24 19:18:24 +03:00
po Translation updates 2026-02-23 13:56:36 +01:00
port Don't treat EINVAL from semget() as a hard failure. 2025-08-13 11:59:47 -04:00
postmaster Prevent restore of incremental backup from bloating VM fork. 2026-03-09 06:55:10 -04:00
regex Avoid assertion due to disconnected NFA sub-graphs in regex parsing. 2024-11-15 18:23:38 -05:00
replication Fix publisher shutdown hang caused by logical walsender busy loop. 2026-03-06 16:44:45 +09:00
rewrite Avoid rewriting data-modifying CTEs more than once. 2025-11-29 12:32:12 +00:00
snowball Avoid null pointer dereference crash after OOM in Snowball stemmers. 2025-02-18 21:23:59 -05:00
statistics Fix set of issues with extended statistics on expressions 2026-03-02 09:38:42 +09:00
storage Fix OldestMemberMXactId and OldestVisibleMXactId array usage 2026-03-02 19:19:29 +02:00
tcop Check for CREATE privilege on the schema in CREATE STATISTICS. 2025-11-10 09:00:00 -06:00
tsearch Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
utils Fix size underestimation of DSA pagemap for odd-sized segments 2026-03-09 13:46:33 +09:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile Fix build inconsistency due to the generation of wait-event code 2026-02-02 08:03:02 +09:00
meson.build meson: Fix import library name in Windows 2024-06-20 09:08:36 +02:00
nls.mk Add missing gettext triggers 2024-05-14 12:57:22 +02:00