On Sunday, March 15, 2020, Horimoto Yasuhiro <
horimoto@clear-code.com> wrote:
I send a patch for this problem.!
From: PG Bug reporting form <noreply@postgresql.org>
Subject: BUG #16303: A condtion whether an index-only scan is possible includes a wrong
Date: Mon, 16 Mar 2020 06:02:25 +0000
> I think that the condition of whether an index-only scan is possible
> includes a wrong.
>
> For example, in the following case, the index has no data to return. Because
> the query doesn't use specify columns.
> However, the query planner choice index-only scan.
> In my opinion, we expected that the query planner doesn't choose an
> index-only scan in the above case.
>
I don't see a behavioral bug here. I would expect that any index would be an acceptable match for a query whose set of return columns is the empty set. The empty set is a subset of all sets.
David J.