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 1tsKfb-000rQ6-Al for pgsql-general@arkaria.postgresql.org; Wed, 12 Mar 2025 11:54:43 +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 1tsKfZ-003UOJ-9J for pgsql-general@arkaria.postgresql.org; Wed, 12 Mar 2025 11:54:41 +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 1tsKfY-003ULi-UR for pgsql-general@lists.postgresql.org; Wed, 12 Mar 2025 11:54:40 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tsKfV-002Pog-2W for pgsql-general@lists.postgresql.org; Wed, 12 Mar 2025 11:54:38 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-ac2a81e41e3so595325966b.1 for ; Wed, 12 Mar 2025 04:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741780476; x=1742385276; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EeJ3/vx9BgqGol08Hr72w0kMIsbUIQR2iTphCrGETZI=; b=QXm2qM18tJTSYpci0VVDj+LFFVvjL4QMny+qiLJCEFmhCWK9+ueWHo+PzvsZm+y9of ZXdN+nRl15JXSuA0OlH8ByLiG+9WmVwP3zE/bqIdNNpvYVab6Nl/zjzkySigIR2pU7W5 +IDKc09HN9ktoyO56ZkvpgdASyCFdpDUuLU8OONcrDuJD6MqmJf5JMto/eLX98tcqBnD 0tg/yLhYpzet8QqyJ9zBIEMwV0BqnQcli/yyJF7Pceg5e0iSdLIq85J1k/B6FjC2c8uw YbeyMo+lqlU1ymkLcLnPiZ5gAd5FpJT5e+ErmHqJqCamsF6ghikWyQYKV1DM3mPI/f2S 198Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741780476; x=1742385276; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EeJ3/vx9BgqGol08Hr72w0kMIsbUIQR2iTphCrGETZI=; b=ljL93/J/Dur+vF1Xc9L/DAh24/ZNXVvm656mOhHClCK7Yh3JkG4CHA7aD1th44jx18 ZrofWQB43Rc8XdAFruINcsEWJwJjDg1buxYIHECGBADat0bxFdWmWaxiKBywjNKxNYvU tuXWQe7xf6CxIOJ6by6rqHLFrxLJcZhKkcHaQRnttSk//QvoOdQ8v9cvxOjmQeKDjFvW ya9o4AZ4HO5PDzuiyq/AI8VwXvd3reyPjwCdo3q2JDI25h0ZDRx9EjvSO8ntzFa1r7rs vPQbIJlnd087z3D1R5/fU4qcTbh1aawFZvGUhXIcctVEEHE3jWaMHh5kjwjY890wi5W2 pUuw== X-Gm-Message-State: AOJu0YwxdE7y439lHdkBapXXbvZ5pZoZ6qLFl8F/DRsJJTZlf+vvgyuu NzAHwfdp+B+dUWvAmE+T6CoujpC8zMTgYYiQYUaHWTo5QJbOFMMLF7RjjoZZBEtUgNoyE4og0Pg 28WNnGIWbhUI7Bdtv5zFUhUpYlOhjwIL+/5I= X-Gm-Gg: ASbGncvJ9kRb7Kc1mwZECdEbLuDRHJUmFcndOwKrPde1dSJQZ3iN66Pkdxf9u4wVBSi airB9TcMupFTfW8Sp7vjHw5IRf2wRly6IqyU7GIh02zKJQZYOkFE2ruKKCTcXo0sgLRcBzCnCAX eC10R6y+YTlrTMUmuRGUUomTU= X-Google-Smtp-Source: AGHT+IG+B2IgNmCM3DCr8WlqfgIQtUjVvdUglZGTfPoRG+5tLz9oWqMirOrNP/8O7Y0x3pLnfFjeos7Tq5Rl1iLGTYU= X-Received: by 2002:a17:906:f589:b0:ac1:f162:fb0d with SMTP id a640c23a62f3a-ac252f8e996mr2117323166b.37.1741780476235; Wed, 12 Mar 2025 04:54:36 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Artur Zakirov Date: Wed, 12 Mar 2025 12:54:25 +0100 X-Gm-Features: AQ5f1Jodkua3IiwYmAjHYyBUhkGqjigVdAnTYUvvJDx70iPqVtRqOolZRfjNnGc Message-ID: Subject: Re: ERROR: could not read block 0 in file when creating an index out of a function To: Luca Ferrari Cc: pgsql-general Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hey, On Wed, 12 Mar 2025 at 10:11, Luca Ferrari wrote: > Now, according to the documentation, the function f_t is immutable > since it is not modifying the database, so what is going on? And why > is the same function working if the table has not the constraint on > the column? I can reproduce this with the table `t` on PG 15.10. In your case `base/357283/365810` file is a new index file. For some reason Postgres tries to read the new index. I suppose this is because during reading the table `t` within the function `f_t` it tries to access the new index. According to the documentation, IMMUTABLE functions should not only modify the database, but also return the same results given the same arguments forever, which might not be true when you query a table within such a function. Such a function should be defined as STABLE or VOLATILE. -- Kind regards, Artur