From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andy Halsall <andyh@live.co.uk>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Question on corruption (PostgreSQL 9.6.1)
Date: Tue, 13 Mar 2018 09:58:31 -0400
Message-ID: <19869.1520949511@sss.pgh.pa.us> (raw)
In-Reply-To: <DB6PR0902MB1878C535A03C87A576532066F5D20@DB6PR0902MB1878.eurprd09.prod.outlook.com>
References: <DB6PR0902MB1878C535A03C87A576532066F5D20@DB6PR0902MB1878.eurprd09.prod.outlook.com>
Andy Halsall <andyh@live.co.uk> writes:
> db=# select * from xxxxx where col_a = 4675635;
> col_a | col_b | col_c | col_d | col_e | last_modified
> --------+-------------+-----------------+-----------+---------------+---------------
> | | | | |
> (1 row)
> Row 4675635 is very odd - NULL columns and at the same time retrievable by a value in col_a.
Doesn't seem particularly surprising if col_a is indexed. That query
would choose an indexscan plan, which would normally not bother to
re-verify the index condition against heap tuples found via the index.
If you're continuing to use this damaged database, it might be a good
idea to try to REINDEX all your indexes. That'd be particularly
useful for primary/unique indexes, since if corruption has led to
any apparent duplicate rows, the reindex would fail and complain.
But in any case it'd clean up heap-vs-index inconsistencies like the
above, as well as repairing any cases where the corruption was in an
index rather than heap.
Another test I'd strongly recommend is to see if you can pg_dumpall
and reload into a spare server. That might catch forms of data
corruption that reindexing would not, such as violated CHECK constraints.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, andyh@live.co.uk
Subject: Re: Question on corruption (PostgreSQL 9.6.1)
In-Reply-To: <19869.1520949511@sss.pgh.pa.us>
References: <DB6PR0902MB1878C535A03C87A576532066F5D20@DB6PR0902MB1878.eurprd09.prod.outlook.com> <19869.1520949511@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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