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 1w5HXg-0035gD-0Z for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 06:16:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5HXe-00CCdy-2J for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 06:16:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w5HXe-00CCdl-07 for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 06:16:34 +0000 Received: from fhigh-b7-smtp.messagingengine.com ([202.12.124.158]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w5HXb-0000000112k-15dZ for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 06:16:34 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 79D4B7A01E6; Wed, 25 Mar 2026 02:16:29 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 25 Mar 2026 02:16:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1774419389; x=1774505789; bh=z2c9ahSW7yeDXiSKH7TQEwK1j1lA2hAeyUysv0V1qnc=; b= F+MiGjxFUpRTZrhTczwkB/lzfYeVwHEdC7tatA8sHHMFuU11sMeohtRHeuzkni9K LSft40ApCi7zg8BVg+e884fZAD2LVBRoTL2jUOffIqlyBvd62DeV5AB//YH8BuGo zvDavZaxJ86KkWUvMDuImPVwyvRnhoWP1EaOMJ6QIBcKiydwZp4v40AB/Nb98BJL /+DK/jdgLN7jdaA3U8UVtfl4OsfviowMWDyehBpIhhuIhyql+gKw3mgcinhraPv8 1Qdyz/AS8WaM4k8i/kc8t7sYx647T7WECefKI72cmviXrcq9d02qw53pebFZpMzE PhK/bkVVVPYUG9E9ZopuHQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1774419389; x=1774505789; bh=z 2c9ahSW7yeDXiSKH7TQEwK1j1lA2hAeyUysv0V1qnc=; b=JF/KOmhuOAF5RaVH5 OvRwkNtsMXm9gBZzzIp4jStOjupL3z5HhTamCNa/IVVoYTCMeJ/hyh3iqb0Z7Umk 1lUiSmW2wZcjog8JQfnVB6rJSMtxgDac9+XHLauiHrQazOXJh86jHzNUuXItwZKI 3Un6G4BWzKejC3WnqOB7KAI9hruVPyEXFigTH6wN6ECP0mg2/5A0GKoGsQ+Pc30q ystC2N8VDv4OYzO3A3JQCqibJY+ajNVGzN3Q92Sh7YO6UznPRsGQhIxdUoNtOEtp wgCXAOrZvufwAGpNfazFhb44YJaa/el5Ak2WuT98YrjQ64lDRCoCiJIyCnERt8yN ymwBA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdefvdefjeduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertd dtvdejnecuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghrsegv ihhsvghnthhrrghuthdrohhrgheqnecuggftrfgrthhtvghrnhepudfgjefffeelfedvge dvjedvieehvefghfejgfduhfevvdejveefheetlefgveefnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhesvghishgvnhhtrhgruh htrdhorhhgpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphht thhopeihjhhhjhhsthiisehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhh grtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 25 Mar 2026 02:16:28 -0400 (EDT) Message-ID: <775ff3bf-01b3-4218-84c0-653b2add1a65@eisentraut.org> Date: Wed, 25 Mar 2026 07:16:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Fix wrong argument to SOFT_ERROR_OCCURRED in timestamptz_date To: Jianghua Yang , pgsql-hackers@lists.postgresql.org References: Content-Language: en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 24.03.26 16:44, Jianghua Yang wrote: >  Hi hackers, > >   I found a small bug in commit e2f289e5b9b ("Make many cast functions > error safe"). > >   In timestamptz_date(), the SOFT_ERROR_OCCURRED() check mistakenly >   uses fcinfo->args instead of fcinfo->context: > >   result = timestamptz2date_safe(timestamp, fcinfo->context); >   if (SOFT_ERROR_OCCURRED(fcinfo->args))   /* should be fcinfo->context */ >       PG_RETURN_NULL(); > >   fcinfo->args is a NullableDatum[] array, not a Node *. The >   SOFT_ERROR_OCCURRED macro casts its argument to Node * and reads >   the NodeTag field. When given fcinfo->args, it interprets the first >   argument's Datum value (a TimestampTz) as a NodeTag, which will >   almost never match T_ErrorSaveContext. This causes the soft error >   check to always evaluate to false. > >   As a result, when the timestamptz-to-date conversion encounters an >   overflow in error-safe mode, the function returns a wrong date value >   instead of the expected NULL. > >   All three sibling functions modified in the same commit (date_timestamp, >   timestamp_date, date_timestamptz) correctly use fcinfo->context. >   This appears to be a copy-paste oversight. > >   The fix is a one-line change: fcinfo->args → fcinfo->context. committed the fix, thanks