pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Lakhin <exclusion@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table
Date: Mon, 26 Feb 2024 09:00:01 +0300
Message-ID: <6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com> (raw)
In-Reply-To: <1660000.1708902298@sss.pgh.pa.us>
References: <18363-e3598a5a572d0699@postgresql.org>
	<1541688.1708893428@sss.pgh.pa.us>
	<ZdvF3lD5W9IySEa8@paquier.xyz>
	<1660000.1708902298@sss.pgh.pa.us>

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





view thread (6+ messages)  latest in thread

Message-ID: <6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com>
Permalink:  ../6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com/
Also on:    postgresql.org/message-id/6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com

 · 

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-bugs@postgresql.org
  Cc: exclusion@gmail.com, tgl@sss.pgh.pa.us, michael@paquier.xyz, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table
  In-Reply-To: <6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com>

* 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