Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1QMr-000I2B-1r for pgsql-hackers@arkaria.postgresql.org; Sat, 14 Mar 2026 14:53:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w1QMq-0022Xa-2A for pgsql-hackers@arkaria.postgresql.org; Sat, 14 Mar 2026 14:53:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1QMq-0022XR-0q for pgsql-hackers@lists.postgresql.org; Sat, 14 Mar 2026 14:53:29 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w1QMo-000000007NN-25Rj for pgsql-hackers@lists.postgresql.org; Sat, 14 Mar 2026 14:53:27 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id EB4143E96A; Sat, 14 Mar 2026 14:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1773500003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fz4I/c8BcnZasHAxZhTnJu/7TMKtNolYx02u/p5eKNQ=; b=QK+4JmAoQzP7pEimRUyg3NPB906bpGyvUnN9tEbGv5bQYNqTZmdHWgS/b0OT75hTBXAkQd eOvL6h1lOeR45Utsv7P1XAbuf9PWzWF+O62SBefISlGxgCmFmzYt/NQzvFQgkq/OSUaaEJ 0zSHkg8KLtuPq9lNR4i+flfzN2gjSpPUdPzl0x0YD2VM8w2TMp26b8b+OhnMjKtbfxb9Nq ZKUcv/TfIplIZXayJuNraMv/KqyCjCV7cwjT/KdtseHinse0Xkul20U2OsrwFcBKIeaJOj wLOtcuMQRuaBGJhvo80AYCnNRaysGGnvqz6pWYf/0sPnApNWRedPgO/80hSQaQ== Message-ID: <77609a7a-4d7f-4c24-890a-5af9ebcfe9bd@vondra.me> Date: Sat, 14 Mar 2026 15:53:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Tighten asserts on ParallelWorkerNumber a little bit To: Bertrand Drouvot Cc: PostgreSQL Hackers References: <5db067a1-2cdf-4afb-a577-a04f30b69167@vondra.me> Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-GND-Sasl: tomas@vondra.me X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvledvkeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomhepvfhomhgrshcugghonhgurhgruceothhomhgrshesvhhonhgurhgrrdhmvgeqnecuggftrfgrthhtvghrnhepledugeeikefglefhgfffuedvleetteevgefhvdeikeefudduuddvhfevudefhfevnecukfhppeekiedrgeelrddvfedtrddvtdeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepkeeirdegledrvdeftddrvddtiedphhgvlhhopegluddtrddufeejrddtrddvngdpmhgrihhlfhhrohhmpehtohhmrghssehvohhnughrrgdrmhgvpdhqihgupefgueegudegfefgleeitedpmhhouggvpehsmhhtphhouhhtpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepsggvrhhtrhgrnhguughrohhuvhhothhpghesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-GND-State: clean X-GND-Score: -100 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/13/26 11:53, Bertrand Drouvot wrote: > ... > >> So AFAICS the assert(s) should be >> >> Assert(ParallelWorkerNumber < node->shared_info->num_workers); > > I think that you're right. It looks like the first one has been introduced > by bf11e7ee2e3 and then the others are probably copy/paste. > >> I don't think we had issues with this not catching a bug. But it may be >> a bit misleading, so worth fixing and (probably) backpatching. > > I do agree. > > With that patch applied, the remaining one: > > $ git grep "<=.*num_workers" > src/backend/executor/nodeGatherMerge.c: Assert(nreaders <= castNode(GatherMerge, gm_state->ps.plan)->num_workers); > > does not need to be fixed, so I think that your patch does not miss any and > LGTM. > Thanks. Pushed and backpatched. -- Tomas Vondra