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 1reU28-00BZkh-NT for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Feb 2024 06:00: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 1reU26-00Aa7d-RA for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Feb 2024 06:00: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 1reU26-00Aa6u-Iu for pgsql-bugs@lists.postgresql.org; Mon, 26 Feb 2024 06:00:11 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1reU20-0016We-05 for pgsql-bugs@lists.postgresql.org; Mon, 26 Feb 2024 06:00:09 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2d0cd9871b3so22399551fa.1 for ; Sun, 25 Feb 2024 22:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708927203; x=1709532003; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=0vv6i5pOxhabMl2fnLytbc9u/J8oHNgXGRVR45z7scw=; b=UmdTWSnpMXofQ8jzN0XBAzQP9jht/XOtJrPtqYy+00hYEuCAWmXZISSDxhzCdIyakb pjvBNZmnOPi1aYxMWI2axOBp3IuENq5bZi5g2EVjbe7jv9amlzPu/un4BqSQ+0dnZcLp OG4BmdjD/ilArIhX9hLiA/Jutx/AEW2g7zR+xArDevDlNUJCh3XMP//qU+WlP+B6Imal y5YF1Ns/DVrVmcD7l/iNQBsUXsYVAL0jkgq+/wC/YfU9Ly+hj5B9IvM5XGD2/A7ZUdmB 4IacXk41VECMet08SPQwUtSqc28Pez32l6NI4uqUDxiaRaWSiD5wdV/6e1/PlzpHPXtD gfEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708927203; x=1709532003; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0vv6i5pOxhabMl2fnLytbc9u/J8oHNgXGRVR45z7scw=; b=dr7C1Hn5toi7Kd2cbbdHgiCMwAowUtQKulObfN68zFP2HL9dTWzZwZZs5YPEVQare0 4UG/GtwaK7vCBEORbiSFE5d7YwJnOH3nHwQtUy/PLSDwYL0dOjcKuD6L1o5Wpzw1cxaM s0O301yj8qKfP2dmS7dres+mZl2Q3d7UyLgdKRAiUW+GaGyyuqkwfJ5wcS22lEuA5iG+ 5uNzZqNjr8ET668aEraL42UJGRFHUYnuDQcH8G3+7MXgeiuKDzEeuvZw8YnKc9FGYJdD Ny7/KcX5ePXv4kgpZhEpx2wexzBF13/IMbSZeVhg8nscHSrftGGF4Nt89wYm5K7VlI+Y WZeg== X-Gm-Message-State: AOJu0YxZ8x7n+/Os8wWIe3nk+IcHjxlMVjOLcyqKhjbvXONTFbKE9a0y H/WFy5qQsyNcQrOzniQrERA0APbVArF7Ko9FPyPl7zbdKfuc6RRO X-Google-Smtp-Source: AGHT+IE6+ogOVMu/AQuF+5PElLmWCJ7eovJD+wyCWQB8KLdImLJZ+zKtX838H7bCe5YI287YcDDqOQ== X-Received: by 2002:ac2:42cb:0:b0:512:c13d:115c with SMTP id n11-20020ac242cb000000b00512c13d115cmr1822246lfl.19.1708927202937; Sun, 25 Feb 2024 22:00:02 -0800 (PST) Received: from [1.0.0.7] ([91.185.78.44]) by smtp.gmail.com with ESMTPSA id h25-20020ac24db9000000b005112ae5fd93sm721058lfe.244.2024.02.25.22.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Feb 2024 22:00:02 -0800 (PST) Message-ID: <6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com> Date: Mon, 26 Feb 2024 09:00:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table Content-Language: en-US To: Tom Lane , Michael Paquier Cc: pgsql-bugs@lists.postgresql.org References: <18363-e3598a5a572d0699@postgresql.org> <1541688.1708893428@sss.pgh.pa.us> <1660000.1708902298@sss.pgh.pa.us> From: Alexander Lakhin In-Reply-To: <1660000.1708902298@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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