public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Luca Ferrari <[email protected]>
Cc: Artur Zakirov <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: ERROR: could not read block 0 in file when creating an index out of a function
Date: Wed, 12 Mar 2025 10:18:07 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKoxK+5ek4R-6kxzJ1TALf_Dxe-dM-xjTLkWp=9_BTP7Gx8Jrg@mail.gmail.com>
References: <CAKoxK+7G+=nEmJdV9k0r_FNNJ5ZCo2we0H8uNNzuCjnbh462mg@mail.gmail.com>
<CAKNkYnyPs8sNwb7Xq3sDSYRgNyHgQNibJjcyrkv596uCOLGXxQ@mail.gmail.com>
<CAKoxK+5ek4R-6kxzJ1TALf_Dxe-dM-xjTLkWp=9_BTP7Gx8Jrg@mail.gmail.com>
Luca Ferrari <[email protected]> writes:
> On Wed, Mar 12, 2025 at 12:54 PM Artur Zakirov <[email protected]> wrote:
>> 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).
Yeah, this has been reported before. While planning the "SELECT FROM
tt" query within the function, the planner tries to access all the
indexes of tt --- including the one that's only half-built.
(Specifically, it wants to know the tree heights of all the btree
indexes.) We've dismissed this as not being something we care to fix,
because the argument that such a function is immutable is specious.
And the case can't really happen without a function referencing the
index's base table; for example, a query from another session can't
see the uncommitted index at all.
regards, tom lane
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: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: ERROR: could not read block 0 in file when creating an index out of a function
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox