Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iai7M-0007Cx-GB for pgsql-general@arkaria.postgresql.org; Fri, 29 Nov 2019 15:23:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iai7L-000082-10 for pgsql-general@arkaria.postgresql.org; Fri, 29 Nov 2019 15:23:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iai7K-0008VT-FS for pgsql-general@lists.postgresql.org; Fri, 29 Nov 2019 15:23:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iai7H-0003oD-Qv for pgsql-general@lists.postgresql.org; Fri, 29 Nov 2019 15:23:33 +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 xATFNPHn013476; Fri, 29 Nov 2019 10:23:25 -0500 From: Tom Lane To: Nandakumar M cc: Laurenz Albe , "pgsql-general@lists.postgresql.org" Subject: Re: Rows violating Foreign key constraint exists In-reply-to: References: Comments: In-reply-to Nandakumar M message dated "Fri, 29 Nov 2019 13:10:07 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13474.1575041005.1@sss.pgh.pa.us> Date: Fri, 29 Nov 2019 10:23:25 -0500 Message-ID: <13475.1575041005@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Nandakumar M writes: >> It could be that somebody disabled the triggers, but that would have to >> be a superuser. And I hope that people randomly disabling system triggers >> on tables don't have superuser access to your database. > It is unlikely that this happened. So I am assuming corruption. > But I am able to query both the referred and referring table > successfully without any 'missing chunk' or similar errors that > usually indicate corruption. > Is it possible that corruption might cause data loss like this without > any errors? The most likely "corruption" explanation is something wrong with the indexes on the referenced and/or referencing column, causing rows to not be found when referential actions should have found them. Random querying of the tables wouldn't necessarily expose that --- you'd need to be sure that your queries use the questionable indexes, and maybe even search for some of the specific rows that seem mis-indexed. regards, tom lane