On Mon, Aug 26, 2024 at 01:35:52PM -0400, Robert Haas wrote:
> On Mon, Aug 26, 2024 at 1:26 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
>> While it is apparently pretty uncommon to use pgstattuple on sequences,
>> this is arguably a bug that should be fixed and back-patched.
>
> I don't understand what would make it a bug.
>
>> IMHO it would be good to establish some level of consistency here.
>
> Sure, consistency is good, all other things being equal, but just
> saying "well this used to work one way and now it works another way"
> isn't enough to say that there is a bug, or that something should be
> changed.
The reason I think it's arguably a bug is because it used to work fine and
then started ERROR-ing after commit 4b82664. I'm fine with saying that we
don't think it's useful and intentionally deprecating it, but AFAICT no
such determination has been made. I see no discussion about this on the
thread for commit 4b82664, and the only caller of pgstat_heap()
intentionally calls into the affected function for sequences (and has since
pgstattuple was introduced 18 years ago):
if (RELKIND_HAS_TABLE_AM(rel->rd_rel->relkind) ||
rel->rd_rel->relkind == RELKIND_SEQUENCE)
{
return pgstat_heap(rel, fcinfo);
}
--
nathan