Re: BUG #18246: pgstathashindex() attempts to read invalid file for hash index attached to partitioned table

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18246: pgstathashindex() attempts to read invalid file for hash index attached to partitioned table
Date: 2023-12-13 18:00:00
Message-ID: 876b6e52-f068-648a-3f0e-7eaabd57cf77@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello Michael,

13.12.2023 17:18, Michael Paquier wrote:
> On Wed, Dec 13, 2023 at 09:00:01AM +0000, PG Bug reporting form wrote:
>> This anomaly can be observed since 8b08f7d48 from 2018-01-19, but IMO the
>> culprit is e759854a0 from 2017-02-03, which introduced the following
>> asymmetry in pgstatindex.c:
>> if (!IS_INDEX(rel) || !IS_BTREE(rel))
>> if (!IS_INDEX(rel) || !IS_GIN(rel))
>> But:
>> if (!IS_HASH(rel))
> Fun, let's fix that. Would you like to write a patch?

Yes, please look at the attached,
I've decided to change also index_open() -> relation_open() because
index_open() only adds a check, that is not suitable for this concrete
case, so there is no much sense to use the different function.
(In fact, that check was good enough at the time of e759854a0, but
8b08f7d48 changed it.)
As a result, error messages for hash indexes are becoming consistent with
other indexes. Also I've added a test case for the issue, but maybe it's
superfluous...

Best regards,
Alexander

Attachment Content-Type Size
v1-fix-pgstathashindex.patch text/x-patch 4.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message 高升 2023-12-14 01:04:55 about psql copy ,we would like to seek help,Thanks.
Previous Message Michael Paquier 2023-12-13 14:18:14 Re: BUG #18246: pgstathashindex() attempts to read invalid file for hash index attached to partitioned table