Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1reLFJ-00Aqyx-2T for pgsql-bugs@arkaria.postgresql.org; Sun, 25 Feb 2024 20:37:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1reLFH-008v7e-F1 for pgsql-bugs@arkaria.postgresql.org; Sun, 25 Feb 2024 20:37:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1reLFH-008v7W-70 for pgsql-bugs@lists.postgresql.org; Sun, 25 Feb 2024 20:37:11 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1reLFE-000zYd-3f for pgsql-bugs@lists.postgresql.org; Sun, 25 Feb 2024 20:37:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 41PKb8md1541689; Sun, 25 Feb 2024 15:37:08 -0500 From: Tom Lane To: exclusion@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table In-reply-to: <18363-e3598a5a572d0699@postgresql.org> References: <18363-e3598a5a572d0699@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Sun, 25 Feb 2024 18:00:01 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1541687.1708893428.1@sss.pgh.pa.us> Date: Sun, 25 Feb 2024 15:37:08 -0500 Message-ID: <1541688.1708893428@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > The following script: > CREATE TABLE t(i INT PRIMARY KEY); > CREATE FUNCTION f(i int) RETURNS int IMMUTABLE LANGUAGE SQL > RETURN (SELECT i FROM t WHERE i = $1); > CREATE INDEX ON t(f(i)); > INSERT INTO t VALUES (1); > REINDEX INDEX t_f_idx; > triggers an assertion failure with the stack trace: > ... > With a non-assertion-enabled build it fails with: > ERROR: could not read block 0 in file "base/16384/16392": read only 0 of > 8192 bytes > CONTEXT: SQL function "f" during startup > 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. regards, tom lane