Re: BUG #18246: pgstathashindex() attempts to read invalid file for hash index attached to partitioned table - Mailing list pgsql-bugs

From Alexander Lakhin
Subject Re: BUG #18246: pgstathashindex() attempts to read invalid file for hash index attached to partitioned table
Date
Msg-id 876b6e52-f068-648a-3f0e-7eaabd57cf77@gmail.com
Whole thread Raw
In response to Re: BUG #18246: pgstathashindex() attempts to read invalid file for hash index attached to partitioned table  (Michael Paquier <michael@paquier.xyz>)
Responses Re: BUG #18246: pgstathashindex() attempts to read invalid file for hash index attached to partitioned table
List 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

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #18246: pgstathashindex() attempts to read invalid file for hash index attached to partitioned table
Next
From: 高升
Date:
Subject: about psql copy ,we would like to seek help,Thanks.