pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Jeff Davis <pgsql@j-davis.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: jian he <jian.universality@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Peter Smith <smithpb2250@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: alvherre@alvh.no-ip.org
Subject: Re: Statistics Import and Export
Date: Sat, 22 Feb 2025 19:03:55 -0500
Message-ID: <614341.1740269035@sss.pgh.pa.us> (raw)
In-Reply-To: <CADkLM=f0a43aTd88xW4xCFayEF25g-7hTrHX_WhV40HyocsUGg@mail.gmail.com>
References: <0b4c098ae3968aa23d6accb691f47bdba143aedd.camel@j-davis.com>
	<Z6WjFqX4f3LVMydD@paquier.xyz>
	<CADkLM=fzX7QX6r78fShWDjNN3Vcr4PVAnvXxQ4DiGy6V=0bCUA@mail.gmail.com>
	<e048dd2e1e6afe55a2521f853e8346f39473ec7d.camel@j-davis.com>
	<CADkLM=cALMHZkXU+xZw9-WeR4XSXzDYj_-xERHg8haYq1zbjhg@mail.gmail.com>
	<26e55538fa8c47d660642f367cd8a19333420789.camel@j-davis.com>
	<348bd8970506784d20c864a9a731420ca15a2f63.camel@j-davis.com>
	<sdno5atrplq5b67vcx7x6fkzevwkzojd23izbguy2yma424wmp@siwbi3ijxdxs>
	<x5yo5ly5u3dhzfaq3hrzeqhju3io5zmwk4yqrkge3ywcflffck@ghbbgsfv56yb>
	<3670503.1740173078@sss.pgh.pa.us>
	<blezfpeafycxlizyynwvwzh2vywmklhvfqudhicjrccu4raqpx@4ttfufowc2vo>
	<3728741.1740178078@sss.pgh.pa.us>
	<CADkLM=f0a43aTd88xW4xCFayEF25g-7hTrHX_WhV40HyocsUGg@mail.gmail.com>

BTW, while nosing around looking for an explanation for our
cross-version-upgrade woes, I chanced to notice that
relation_statistics_update rejects negative values for
relpages and relallvisible.  This is nonsense.  Internally
those values are BlockNumbers and can have any value from
0 to UINT32_MAX.  We represent them as signed int32 at the
SQL level, which means they can read out as any int32 value.
So the range checks that are being applied to them are flat
wrong and should be removed.  Admittedly, you'd need a table
exceeding 16TB (if I did the math right) to see a problem,
but that doesn't make it not wrong.

It might be a good idea to change the code so that it declares
these values internally as BlockNumber and uses PG_GETARG_UINT32,
but I think that would only be a cosmetic change not a
correctness issue.

			regards, tom lane





view thread (543+ messages)  latest in thread

Message-ID: <614341.1740269035@sss.pgh.pa.us>
Permalink:  ../614341.1740269035@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/614341.1740269035@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, corey.huinker@gmail.com, andres@anarazel.de, pgsql@j-davis.com, michael@paquier.xyz, jian.universality@gmail.com, nathandbossart@gmail.com, bruce@momjian.us, boekewurm+postgres@gmail.com, magnus@hagander.net, sfrost@snowman.net, ashutosh.bapat.oss@gmail.com, smithpb2250@gmail.com, pgsql-hackers@lists.postgresql.org, alvherre@alvh.no-ip.org
  Subject: Re: Statistics Import and Export
  In-Reply-To: <614341.1740269035@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox