pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alban Hertroys <haramrae@gmail.com>
To: Nicola Contu <nicola.contu@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Cc: Alessandro Aste <Alessandro.aste@gtt.net>
Subject: Re: Restore from dumps
Date: Wed, 25 Jul 2018 11:28:45 +0200
Message-ID: <80053159-EE7C-4F76-93E9-FCF5C2169E91@gmail.com> (raw)
In-Reply-To: <CAMTZZh0-v1JBKyyNxF=D2nHecetDxX05cT=PkqqmBUtpK-TKKg@mail.gmail.com>
References: <CAMTZZh0-v1JBKyyNxF=D2nHecetDxX05cT=PkqqmBUtpK-TKKg@mail.gmail.com>


> On 25 Jul 2018, at 9:43, Nicola Contu <nicola.contu@gmail.com> wrote:
> 
> Hello,
> 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.

What are the commands you used? You don't seem to mention restoring the schema?

> 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;

Is all_days a table? Or is it perhaps another view, possibly materialized even?

> The relation is there, in fact if I go there when I get in to the office, the same command works.

This sounds to me like you may be using a different version of pg_restore in the office. Are both versions 10.4 or newer?
It can't hurt to check that you used version 10.4 of pg_dump as well.

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.





view thread (8+ messages)  latest in thread

Message-ID: <80053159-EE7C-4F76-93E9-FCF5C2169E91@gmail.com>
Permalink:  ../80053159-EE7C-4F76-93E9-FCF5C2169E91@gmail.com/
Also on:    postgresql.org/message-id/80053159-EE7C-4F76-93E9-FCF5C2169E91@gmail.com

 · 

reply

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: haramrae@gmail.com, nicola.contu@gmail.com, Alessandro.aste@gtt.net
  Subject: Re: Restore from dumps
  In-Reply-To: <80053159-EE7C-4F76-93E9-FCF5C2169E91@gmail.com>
  References: <CAMTZZh0-v1JBKyyNxF=D2nHecetDxX05cT=PkqqmBUtpK-TKKg@mail.gmail.com> <80053159-EE7C-4F76-93E9-FCF5C2169E91@gmail.com>

* 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