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 1fiGgy-0007i6-Vl for pgsql-general@arkaria.postgresql.org; Wed, 25 Jul 2018 10:06:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fiGgw-0004tZ-R9 for pgsql-general@arkaria.postgresql.org; Wed, 25 Jul 2018 10:06:46 +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 1fiGgw-0004tS-JK for pgsql-general@lists.postgresql.org; Wed, 25 Jul 2018 10:06:46 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fiGgt-00075U-TD for pgsql-general@lists.postgresql.org; Wed, 25 Jul 2018 10:06:45 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 1C3C147FE0; Wed, 25 Jul 2018 12:06:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id MRaJa1tVnxhB; Wed, 25 Jul 2018 12:06:40 +0200 (CEST) Message-ID: <1532513198.2489.1.camel@cybertec.at> Subject: Re: Restore from dumps From: Laurenz Albe To: Nicola Contu , pgsql-general@lists.postgresql.org Cc: Alessandro Aste Date: Wed, 25 Jul 2018 12:06:38 +0200 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Nicola Contu wrote: > we recently moved from postgres 9.6.6 to 10.4 > > We perform a pg_dump in production to restore daily in a preprod env. > This process used to work perfectly, but now we have a tiny problem. > > We first restore data, we perform a vacuum and then we restore matviews. > Restoring matviews now we have : > > pg_restore: [archiver (db)] Error while PROCESSING TOC: > pg_restore: [archiver (db)] Error from TOC entry 23090; 0 1912379424 MATERIALIZED VIEW DATA matview_vrs_request_sla postgres > pg_restore: [archiver (db)] could not execute query: ERROR: relation "all_days" does not exist > LINE 3: from all_days > ^ > QUERY: > select count(*)::numeric > from all_days > where (("date" between $2::date and $1::date) or ("date" between $1::date and $2::date)) > and dow not in (0,6) > > CONTEXT: SQL function "bdays" during inlining > Command was: REFRESH MATERIALIZED VIEW public.matview_vrs_request_sla; > > The relation is there, in fact if I go there when I get in to the office, the same command works. > > I'm not sure why it does not work here, this seems really strange to me. I suspect that it has to do with the recent security fixes around the "public" schema. Try to ALTER the materialized view so that it refers to "public.all_days" rather than "all_days". Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com