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 1qpWTm-0063dT-Kw for pgsql-bugs@arkaria.postgresql.org; Sun, 08 Oct 2023 16:18:06 +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 1qpWTk-007bsS-1t for pgsql-bugs@arkaria.postgresql.org; Sun, 08 Oct 2023 16:18:04 +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 1qpWTj-007bsK-Pt for pgsql-bugs@lists.postgresql.org; Sun, 08 Oct 2023 16:18:04 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qpWTi-000eKs-De for pgsql-bugs@lists.postgresql.org; Sun, 08 Oct 2023 16:18:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 398GHrKV3326256; Sun, 8 Oct 2023 12:17:53 -0400 From: Tom Lane To: ocean_li_996@163.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18150: The results returned by index only scan using gist index of bpchar and seqscan have difference. In-reply-to: <18150-b3922f47e62d4d12@postgresql.org> References: <18150-b3922f47e62d4d12@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Sun, 08 Oct 2023 15:52:05 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3326254.1696781873.1@sss.pgh.pa.us> Date: Sun, 08 Oct 2023 12:17:53 -0400 Message-ID: <3326255.1696781873@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > PostgreSQL version: 11.9 > When testing consistency between index (only) scan and seqscan, I found that > the results returned by index only scan using gist index of bpchar and > seqscan have difference. This was fixed last year, in 11.15 (and releases of same date in other branches). Per those release notes: Fix results of index-only scans on contrib/btree_gist indexes on char(N) columns (Tom Lane) Index-only scans returned column values with trailing spaces removed, which is not the expected behavior. That happened because that's how the data was stored in the index. This fix changes the code to store char(N) values with the expected amount of space padding. The behavior of such an index will not change immediately unless you REINDEX it; otherwise space-stripped values will be gradually replaced over time during updates. Queries that do not use index-only scan plans will be unaffected in any case. regards, tom lane