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 1gWfu0-0001LW-6i for pgsql-general@arkaria.postgresql.org; Tue, 11 Dec 2018 11:08: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 1gWfty-0002mn-N7 for pgsql-general@arkaria.postgresql.org; Tue, 11 Dec 2018 11:08:34 +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 1gWfty-0002mg-2e for pgsql-general@lists.postgresql.org; Tue, 11 Dec 2018 11:08:34 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gWftr-0005QS-HI for pgsql-general@lists.postgresql.org; Tue, 11 Dec 2018 11:08:32 +0000 Received: by mail-qt1-x843.google.com with SMTP id l11so15907982qtp.0 for ; Tue, 11 Dec 2018 03:08:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CKCrrwOUD5Jn2ItmhseudWjqzfcQiK7rzYggquvIIbM=; b=lAdybe6J3p09lKCYuzTPByK1fv4CdX1jDeRL0DSlKpJ//LuAYUqUhWcYEoY2lktrjX yXuPAmyMNDqUgVeOHIac5zxO0wzX4spbcPQnFZtY3sQ1FhiSHX6OWg+sFxbQBesGyqMb /lJdYuQ10wpvg4k5dD1L6IxH4bCq4/FHU1usX8bmAyzieMs+gXFgmNua4rqNe5S8t1lJ I4zIMOGdnW40658fgX+KUhR6fhcMHGDv+2E9GK4pCfekgs+nHTLaXc2S7Vs/6t5mlzZd sWEUMTmZWSEVaWPngbzvGlzmn5ux/lvhe1xZTU3v/O67yHYsqDnkj7Aao+Go6+hkvVQn CANA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CKCrrwOUD5Jn2ItmhseudWjqzfcQiK7rzYggquvIIbM=; b=jchkS5Rtb3T6wdSSSo99qBnIWEZqq0ioAqWCW8nJQ+xkF5jK43+88DMF9OJ5uQUd/z R9hrbr2X0/lFu8Wm3AUPCAqBdDTcTvA+qzlF5Cd1xtY05vS03zrpGC7YopYlVQm8JaL0 GXCl65buamWkZ6X4wAOuJQc5e54X4vbxn+ehXX3bqg5elYYIgGyYmWQiRy6JraToIuEq ZLniTrnnl3ydG6D2OLgsnkCk2Cdhl4S9V5upW0XQUO7HFdZq1A+tSKS5toe7v/FThLTf /dgWTluyo4CdzF9TH0zbXFX1oV8vXDMMQogAbcE3dh078YFerzg09HgmOpfPo+ZigpTG F/uA== X-Gm-Message-State: AA+aEWbNuE11Y8gVdnp8pXXgE8mRhotVsXJnV62cMddNnue3pHuoIdKX 95nT+6ECkZOjycx+mxMkiMUopxk6kFdYgQ3HCr4= X-Google-Smtp-Source: AFSGD/Vc8rFCukog3kjo8dOc4uepihhF4FlIhD7DJtjkIolavb4Wne4r6V86gMqTc5VDtiGHSgDTWDDbzCmQ1Jzs0CI= X-Received: by 2002:a0c:aee1:: with SMTP id n33mr14778168qvd.169.1544526506643; Tue, 11 Dec 2018 03:08:26 -0800 (PST) MIME-Version: 1.0 References: <28278.1544463193@sss.pgh.pa.us> In-Reply-To: <28278.1544463193@sss.pgh.pa.us> From: Olga Vingurt Date: Tue, 11 Dec 2018 13:07:49 +0200 Message-ID: Subject: Re: pg_restore fails due to foreign key violation To: tgl@sss.pgh.pa.us Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000c6553d057cbd193f" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000c6553d057cbd193f Content-Type: text/plain; charset="UTF-8" Tom Lane wrote: > Hm. In theory, that truncation failure in itself shouldn't have caused a > problem --- autovacuum is just trying to remove some empty pages, and if > they don't get removed, they'd still be empty. However, there's a problem > if the pages are empty because we just deleted some recently-dead tuples, > because the state of the pages on-disk might be different from what it > is in-memory. It indeed looks like that was exactly the issue. The error we saw in the event log happened only once and mentioned the specific table we had issues with. We had rows in the table which should have been deleted due to foreign key constraint (ON DELETE CASCADE configured for the foreign key) and when I tried to select one of the rows by using the column with the foreign key nothing returned in the query so I guess the matching index was missing the rows. In the short term, what you need to do is figure out what caused the > permission failure. The general belief among pgsql-hackers is that > shoddy antivirus products tend to cause this, but I don't know details. > There is no antivirus on the Windows server. As it happened only once (in a few years we installed on the server) and we don't have any additional info why PostgreSQL got "Permission denied" error we will hope for the best i.e. that we won't get into this situation again. Thanks a lot for the help! Regards, Olga --000000000000c6553d057cbd193f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Tom Lane <tgl@sss.pgh.pa.us> wrote:
Hm.=C2=A0 In theory, that truncation failure in = itself shouldn't have caused a
problem --- autovacuum is just trying= to remove some empty pages, and if
they don't get removed, they'= ;d still be empty.=C2=A0 However, there's a problem
if the pages are= empty because we just deleted some recently-dead tuples,
because the st= ate of the pages on-disk might be different from what it
is in-memory.= =C2=A0

It indeed looks like that was exact= ly the issue.=C2=A0
The error we saw in the event log happened only onc= e and mentioned the specific table we had issues with.=C2=A0=C2=A0
We h= ad rows in the table which should have been deleted due to foreign key cons= traint (ON DELETE CASCADE configured for the foreign key) and when I tried = to select one of the rows by using the column with the foreign key nothing = returned in the query so I guess the matching index was missing the rows.
In the = short term, what you need to do is figure out what caused the
permission= failure.=C2=A0 The general belief among pgsql-hackers is that
shoddy an= tivirus products tend to cause this, but I don't know details.

There is no antivirus on the Windows server. As= it happened only once (in a few years we installed on the server) and we d= on't have any additional info why PostgreSQL got "Permission denie= d" error we will hope for the best i.e. that we won't get into thi= s situation again.
Thanks a lot for the help!

R= egards,=C2=A0
Olga=C2=A0=C2=A0


--000000000000c6553d057cbd193f--