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.98.2) (envelope-from ) id 1xRJZq-00000000ruz-2s98 for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Nov 2026 01:26:11 +0000 Received: from localhost ([127.0.0.1]:41328 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xRJZp-0000000E4ZU-2RyE for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Nov 2026 01:26:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:60608) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xRJZo-0000000E4ZI-2wIf for pgsql-bugs@lists.postgresql.org; Thu, 12 Nov 2026 01:26:09 +0000 Received: from fhigh-b7-smtp.messagingengine.com ([202.12.124.158]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xRJZn-00000000Stn-16Cl for pgsql-bugs@lists.postgresql.org; Thu, 12 Nov 2026 01:26:07 +0000 Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfhigh.stl.internal (Postfix) with ESMTP id B7B947A01E0 for ; Wed, 11 Nov 2026 20:26:05 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 11 Nov 2026 20:26:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc: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=1794446765; x=1794533165; bh=tnsdE2o/mv /OCb6KxtIUwj6SOcW3+xpWDtMG1kOkAEE=; b=OfGLLq/q2QajOZ5AkdSvKUcxy8 W/HRQdHx27XRTtWXiphgecL4lcOThaHxiGivXroCN/3gJU7XMMQMjKTSCkgiwNC0 j32eynXD/DwWgSTgEWk9H6ekVGyyJATdFe8/okm0jDkYAqhPKX1wtpYJGyJOYC/S Bvsc6xsAQYJSWIa1SvlEFEd7qKk90/+8tLtlvOuUIyLLSc0r7MI5nYbYCWlcNE8Z wPDsZ0Wm9YonhP8N06KyvlqtDZjlHBiz0UdbrBf39uFm4INFXQ7BL/OhjqLBLbek Ye044oqzGDfmP0/yhjDezjY80mCRcWPz3f7DMB1Uig/amN0cUE+0jk9krEdw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=fm3; t= 1794446765; x=1794533165; bh=tnsdE2o/mv/OCb6KxtIUwj6SOcW3+xpWDtM G1kOkAEE=; b=rt7bKDCZiF/C/dmAtUzZwNhmp0YSjRe8etGMAIUq9rtBz7pkJIu 8XTeo+phttyP+pY3tRFcOBBl880KeqnAe1xQ10hhGUxyA10KmbmAGZI/yF3r3nDs VlYwAsI2krmzwK0V06ReoJJSWuGWzxW3maUmIKKT6Pr4+injJdVPR5NZSuveS8UM zmfMc74FzP5/jqpFe3hfDAUD1sYXXJyrxKkbzHq5AR3LZtSdxGsFPWKBU2cwa5mg FnpHOlFRyishOnusaRC8kQU6R1UWOMAhBp+XtjGs/ll6Q+MvPTc4c89L5GOjwZ7d Dg8zr2ZlxULq9aUgjxHFA6uBjPleDCgNwFg== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=paquier.xyz a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1794446765; d=paquier.xyz; mf=PG1pY2hhZWxAcGFxdWllci54eXo+; rt=PHBnc3FsLWJ1Z3NAbGlzdHMucG9zdGdyZXNxbC5vcmc+; s=fm3:rsa-sha256:N3EaTldSSaJxp+gSCYfvomYr9depV+LFQKP6MZsKTanTWkU 1MBMqRDY8ijxCKv6vvEJ8kcw1tWTmak2Flh2E8jCX4fbu8bJAtxoAb3ZSzo6V23W BzJWNxM1XI6FHodQpQjd7C2tG7ERhFdmsdZPvb0eNULxtbxlyx8sNCHMExy/7jnx SMmYUnY6rfGNZwLhSNZ0eL/UCvaj+jeuaVy3/f4vB8CFy1bhdSbekWEBV/3CQueq 3eT7XwTeAqCOHckTILF5QEUjYxDgasMbCF2EoEdjZhtRELKOGEGRLLT0pbW7kftO lzCJjMA/PjscAj2pnCZwWab6rfGrgqab6+K0CoQ==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:O9FSNaeIsHiLvUXwRJWKg5gOKY4Lh99h9VnXUgNKogA=:K0dseVed9N3vn809R6ylPVDh+n9yEBingxARl6TO738=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEgPB+WrET8G3hVH8muE8ZTOc7gJFI2i9l5uC0zxZpqjkJ5IlQf/K2wdgIFSnLWfJ nbyESL8UL8G/BgKouRY7kdnd6j3f167ZEk+2ZFluyQ6oZQ21KCPZpKEq2pQyVGAPoBcvVk DVqOgOp4zIvzhvvOtw5KsszonfqlJmViHPzMWs5gMgFeOEsr7cWtRWxuRWi/XcEhoI7HKu MbWNw7fo/an55wQpUHYWI3e6/+CeyYTH8tseux3f+9Ljttmp5M1IDmOlh7qdsduiadRjCB WmZfEHhYnIc9gFYlSX4f0eC1KnHOyfRvT8Ie05scidip7U126c4KEqqXikRjsNWo5Ch7ap kA02VVUzeY2x9likt/zGaND6a6U2Au60NL+GqJm5RHzG6p70ffT0BPjMCIGho7sG5jXGhJ iF47tn1mxOipqlOW2GE6vSz8Cru7x3BEOyWMtxk8f6VABpU3dwQ16OBl9ylXLMxNCI+1nJ jcl8lo0+H4e0Am7PHFPBdj0HLcxhImbmpol/rq/VC779AAEj0FAcMv5WRXtdmCRZfwGO4O MY2EvNNCveVSOV+OZFSvtItcTIr+YX65C0ugBuRX+iPtCiF3XpLdX2xO7DByu48DgYdDE/ FTCB6VJ32BDbe6h2xByAEkwa67LHpR6YezKgE2a96xVUsh1+dVmLoCA5IMkQ X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Nov 2026 20:26:04 -0500 (EST) Date: Thu, 12 Nov 2026 10:26:00 +0900 From: Michael Paquier To: Corey Huinker Cc: pgsql-bugs@lists.postgresql.org, 125atishprak@gmail.com Subject: Re: BUG #19857: Stats restore rejects empty arrays, losing range and array stats Message-ID: References: <19857-6e808a09ff4b75d2@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Eqr77wFyjyZuSzBG" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Eqr77wFyjyZuSzBG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Nov 12, 2026 at 07:40:47AM +0900, Michael Paquier wrote: > Yeah, I intend to wrap this one this morning. Applied this down to v19, to match with the empty array cases that have been introduced in 261f89a976b. I think that this leaves an extra case, though... In v17 and v18, it is possible for range_empty_frac to be stored with range_length_histogram as NULL. On v19 and HEAD, range_length_histogram is an empty array, so the two are always set. The restore functions require the two together when upgrading to 18~, meaning that some stats values could be lost when upgrading/dumping the stats from a v17 or v18. That's one pattern that Atish was mentioning originally in his report, even if I got a bit lost in my mind due to the dump/upgrade mentions with v19 and HEAD. I cannot really get excited to allow this combination in the restore functions, though, as it means being more lenient on range_length_histogram forever, and the v19~ decision of using an empty array is much better to me in the long term. An extra argument is that this case is super narrow anyway, unlikely to be hit in practice? As far as I can see, you need a [multi]range column with less than *2* non-empty values.. I agree that we should move on with fixing the extstats restore functions, of course, in terms of the handling of the empty array values, to map now with what the attribute restores are able to do. And fix this second issue down to v19. Let's do that on the other thread, we are done here for me. -- Michael --Eqr77wFyjyZuSzBG Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmr1FagACgkQnvQgOdby QH1YXw/9FWNA10QuqPqBeKZiEeqC7yrqdftpfJU2XJ1kn2XWaMiVcEAT71OdZsTx lOfhhyZrucm2qbWO/U04cFdecVqPC5NkzTX3LJCWp2zLhAJ6OkuOA7Hx7UpO+991 8ToFoHMI6Yie8j9giL08iCAMsXiWhCol5hjmzh1UDLjjKJ2AydhcPBESqxAp7ZVA 3lllrgEBeFFa/7tS1PTJKB9/rhAHiiPPNCE7rkhW/DHJmn0adSHhPaxg3ChQSoqH S7RTvJZIvrPHfjzx+WyGuuAQ/SsU3Qh7VWs/uVBxpvgT4zjJhT8u0gICzSRvyYd6 RAEOPAxqrMSVhxkgEeYcd3A4Jn20CNjwHwZ3dWJLGhX+WmNQixkDsu9pJqvYQPyI 2gj/QY6yZe0rLVBdt/NJK5izxb33MpSy2CbjHnM5bIHTYbOAWzB3qM2glQQodm3U 3Cu9YvzlqLP6sOWocBGc2ud1/ohyLpjlS6MeuOlX5wOUQb04UVarHe5F1hBgwDYi q02knpVuqYGTaccDe+VTfN21hX7UP9fGJpZjqeAcmeeXahrIM+lYd6LYSADhPhYk MmEDOeYiWC0lH8VFhcZH74Y4SotaYBeIhNzvK23b5H/BsOTt+pGULrNdnb45RWfX ETPMso+wwdmAQNA5UoQJxQyN1qRVw+jKSIg34IMGFk/AI67v/IM= =3h9E -----END PGP SIGNATURE----- --Eqr77wFyjyZuSzBG--