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 1tsLFU-000wkQ-EP for pgsql-general@arkaria.postgresql.org; Wed, 12 Mar 2025 12:31:48 +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 1tsLFS-004Dpn-B9 for pgsql-general@arkaria.postgresql.org; Wed, 12 Mar 2025 12:31:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tsLFR-004Dpd-VC for pgsql-general@lists.postgresql.org; Wed, 12 Mar 2025 12:31:45 +0000 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tsLFO-002RFj-1L for pgsql-general@lists.postgresql.org; Wed, 12 Mar 2025 12:31:45 +0000 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5fe8759153dso2527835eaf.1 for ; Wed, 12 Mar 2025 05:31:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741782702; x=1742387502; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1xeQtDrZIlxnFajt3YkrdocoGfIC/WBKHDTQqmzKcGY=; b=ljtwprx413Rgg7vlzmWhuFXTjnTe4p4s1jdHdkUFJTojySe5PbAknhaerlh0g0s5Bg 2zd/WoI68HsTpOoHqd0b2HX9IHz4OVV01Vv9l1ZcfDuJELTBgcoCXia+LIFud/JGaoGt vKGD4aEVQhtuig0mt547kWGlLgotA76Ouqhyb8yqwa7+UgQfZ+5kQKHug5x8IP0JOC79 dPYWvc2wx8LebkCfkCzrSNeajsSqi24/lR3LpS4+gCmLSQ5wyDx7GZYNJd2ACUq1qLuN 6eIWGXlgXaO+/RvQPXj1m9wJIaULItNMjG+TDa1YTlbUM3r7o0hah409VbJ/S1otXFks tNoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741782702; x=1742387502; h=content-transfer-encoding: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=1xeQtDrZIlxnFajt3YkrdocoGfIC/WBKHDTQqmzKcGY=; b=G7nejpKMGySMg6rpK3lp7rEd8aixvOnEX2K6e6fGorQdDxqMHRhJfV4tXjclLifiMa Zv1BI2amQyYfZ2CXECSSM208sqIkDsUuEZsm3qvBSDFEMssZ51Aho/CvNt7lvu/SwVVU Sfa7f4b1/OWYUemqRDTupNoayJHsslwQJCIMjOXvkWn12TBnCEQ59gRiDutkK2NaOFax eoKv+5r4ixYmCP1dr/5P/4ujq5H8CWRkpBiUltXXPrKFtpSnjIpctxIp+xh4vR9HEsrZ sGZ95Vlq4PYVNx0w7kc5EhMOGKYJUfwpeAvM8Dxw9ZJBC+TVgAjdjzICxmVo9kUBYLv6 RlsQ== X-Gm-Message-State: AOJu0YxlJ41NbSfcArJNlamWvKy+iOQQKliBGdz6+mF8OoECd9i0CmzK mxj4LMdrPUtLAa+I+UkTdKQoZilYHMMzlV3pDEq39NcWL1yTonTwoYho5jBKD7egyMx1qJhQ0Ky HAUrykfh7EtT1VW6r0qsbu04y9w0= X-Gm-Gg: ASbGnctrUnU7Wpeow8KYdMbMA+Tw43+JTBNd4rBAkg1kFNyMZpsZYWuhHz9+1jyGcqB WbFo1rvi0QnDn0bAnw2PqD4ITQPHpPdUD7mx+rFY9v9rNW05rbqLZnRhIWufkxDSqnq1xYlO7Dn gRY0PtAeX9hywgr+L1Qrx2QwMq X-Google-Smtp-Source: AGHT+IHYp/3oqYKBwI3zicz4XVr1SNnuxhH1xoMI2AyvC+kgD3u7gpE4b8UZMX9C+Jv9278HSMqW7NM1UXm/G09PH0U= X-Received: by 2002:a05:6820:2018:b0:5fe:87b7:40f5 with SMTP id 006d021491bc7-6004ab182bfmr8591824eaf.5.1741782701739; Wed, 12 Mar 2025 05:31:41 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Luca Ferrari Date: Wed, 12 Mar 2025 13:31:05 +0100 X-Gm-Features: AQ5f1JrI2GR-jw5u9iKKuf6icJCPwrugCHoUIYuG9vLjsT4VdzhED249tEvv0uc Message-ID: Subject: Re: ERROR: could not read block 0 in file when creating an index out of a function To: Artur Zakirov Cc: pgsql-general Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Mar 12, 2025 at 12:54=E2=80=AFPM Artur Zakirov = wrote: > > I can reproduce this with the table `t` on PG 15.10. I didn't mention I'm running 16.6, but I'm pretty sure it is reproducible on other versions too. > > 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. Yeah, even if it is not clear to me why it is trying to read the index that is under creation (i.e., not usable yet). > > 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. As I stated, this example is controversial, and as the documentation states, the IMMUTABLE set of functions should not perform database lookups, as in my example. However, the error message is quite obscure to me, and reminds me a disk corruption rather a stability/function/lookup problem. Luca