pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16849: index and table data inconsistency
2+ messages / 2 participants
[nested] [flat]

* BUG #16849: index and table data inconsistency
@ 2021-02-02 10:33 PG Bug reporting form <noreply@postgresql.org>
  2021-02-02 15:51 ` Re: BUG #16849: index and table data inconsistency Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2021-02-02 10:33 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: kokdemir@gmail.com

The following bug has been logged on the website:

Bug reference:      16849
Logged by:          Ibrahim Edib Kokdemir
Email address:      kokdemir@gmail.com
PostgreSQL version: 12.2
Operating system:   centos 7
Description:        

I have data in a varchar field like '092', '00000000169', '0000001' and so
on. There is a btree index on this field. my searches are similar to below
ones. 
select searched_field from searched_table where searched_field = '092';

When I search data, it uses the given index and returns no value. But when I
disable index scan, it does a sequential scan and return data. 

We have witnessed this case in one index in our production(11.7) and
staging(12.2) environments on same index.  Then we dropped the index and
recreate it. The problem is solved. But, to me, index and data must be
consistent.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #16849: index and table data inconsistency
  2021-02-02 10:33 BUG #16849: index and table data inconsistency PG Bug reporting form <noreply@postgresql.org>
@ 2021-02-02 15:51 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-02-02 15:51 UTC (permalink / raw)
  To: kokdemir@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> I have data in a varchar field like '092', '00000000169', '0000001' and so
> on. There is a btree index on this field. my searches are similar to below
> ones. 
> select searched_field from searched_table where searched_field = '092';

> When I search data, it uses the given index and returns no value. But when I
> disable index scan, it does a sequential scan and return data. 

> We have witnessed this case in one index in our production(11.7) and
> staging(12.2) environments on same index.  Then we dropped the index and
> recreate it. The problem is solved. But, to me, index and data must be
> consistent.

Most likely you got bit by an operating-system locale change causing
a change in sort order and thereby making the index self-inconsistent.
See

https://wiki.postgresql.org/wiki/Locale_data_changes

There's work afoot to have Postgres automatically notice when the
OS changes underneath it, but that's not done yet.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-02-02 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 10:33 BUG #16849: index and table data inconsistency PG Bug reporting form <noreply@postgresql.org>
2021-02-02 15:51 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox