Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table - Mailing list pgsql-bugs

From Alexander Lakhin
Subject Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table
Date
Msg-id 6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com
Whole thread Raw
In response to Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table
List pgsql-bugs
Hello Tom and Michael,

25.02.2024 23:37, Tom Lane wrote:
>> Surely, such an index will not work correctly anyway, but may be it makes
>> sense to replace that Assert with ereport(ERROR).
> Yeah, I guess so.  We periodically get reports of the non-assert
> failure, and this would let us issue a more on-point error message.
> I'm slightly worried about the extra cost, but typically
> pendingReindexedIndexes should be empty or at least short, so it's
> probably negligible.

Thank you for fixing that!

I've also got the same error (but not the assert) with CREATE INDEX:
CREATE TABLE t(i int PRIMARY KEY);
CREATE FUNCTION f(c int) RETURNS INT IMMUTABLE LANGUAGE SQL
     AS 'SELECT i FROM t WHERE i = $1';
INSERT INTO t VALUES (1);
CREATE INDEX ON t(f(i));

ERROR:  could not read block 0 in file "base/16384/16391": read only 0 of 8192 bytes
CONTEXT:  SQL function "f" during startup

It looks like currentlyReindexedIndex == 0 in this case, so
ReindexIsProcessingIndex() doesn't guard against get_relation_info() ->
_bt_getrootheight() -> _bt_getbuf() -> ReadBuffer() -> ... -> mdread().

Best regards,
Alexander



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18362: unaccent rules and Old Greek text
Next
From: Tender Wang
Date:
Subject: Re: "type with xxxx does not exist" when doing ExecMemoize()