Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAi75-0006Ec-OS for pgsql-general@arkaria.postgresql.org; Thu, 11 Oct 2018 21:03:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gAi73-0005iU-7i for pgsql-general@arkaria.postgresql.org; Thu, 11 Oct 2018 21:03:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAi72-0005iN-Vw for pgsql-general@lists.postgresql.org; Thu, 11 Oct 2018 21:03:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAi70-000808-W2 for pgsql-general@lists.postgresql.org; Thu, 11 Oct 2018 21:03:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w9BL38pg024101; Thu, 11 Oct 2018 17:03:08 -0400 From: Tom Lane To: Ron cc: Dmitry O Litvintsev , pgsql-general@lists.postgresql.org Subject: Re: something weird happened - can select by column value although column value exist In-reply-to: <0e111ff0-3a39-f22b-f823-1934e9db0732@gmail.com> References: <0e111ff0-3a39-f22b-f823-1934e9db0732@gmail.com> Comments: In-reply-to Ron message dated "Thu, 11 Oct 2018 15:23:21 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <24099.1539291788.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 11 Oct 2018 17:03:08 -0400 Message-ID: <24100.1539291788@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ron writes: > On 10/11/2018 03:17 PM, Dmitry O Litvintsev wrote: >> Today the following happened: >> < 2018-10-11 13:31:52.587 CDT >ERROR: insert or update on table "file"= violates foreign key constraint "$1" >> < 2018-10-11 13:31:52.587 CDT >DETAIL: Key (volume)=3D(155303) is not = present in table "volume". >> [ but it is present ] >> >> What is this? Version 9.3.9,. running on Linux RH6. > Index corruption?=C2=A0 Maybe rebuild the FK. Yeah, I'd suspect index corruption as well, particularly seeing that this is a three-year-old point release in a branch that had more than its share of data corruption issues. My suggestion is first update to 9.3.latest, then reindex. BTW, 9.3.x will be EOL next month, so you should be thinking about getting onto a later release branch ... regards, tom lane