pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Henrik Uggla <Henrik.Uggla@kristianstad.se>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: SV: SV: Refreshing materialized views
Date: Wed, 29 Nov 2017 14:19:06 +0000
Message-ID: <2886758ebe314e13a73fb27f5c7d6cd4@kristianstad.se> (raw)
In-Reply-To: <CA+OR6cTj8d4g+LLATg2QAGBjXTmF_w__tpGpJNKuFsA4_E3m7w@mail.gmail.com>
References: <9240031180ff4c419251652f39908dd0@kristianstad.se>
	<13279.1511879147@sss.pgh.pa.us>
	<dbc16879aa424296bb1c4950c732cb57@kristianstad.se>
	<23154.1511882315@sss.pgh.pa.us>
	<CAAZnbVoxfchioGbiT5edqz+qJzJETOyLM=9EUy64aVzyCwAMqw@mail.gmail.com>
	<CA+OR6cTj8d4g+LLATg2QAGBjXTmF_w__tpGpJNKuFsA4_E3m7w@mail.gmail.com>

I finally managed to sort out all needed permissions and mappings.
Thanks for all replies!

cheers
Henrik
________________________________________
Från: Ben Primrose <bprimrose@tracelink.com>
Skickat: den 29 november 2017 12:42:56
Till: Daevor The Devoted
Kopia: hendrik.uggla@kristianstad.se; pgsql-general@lists.postgresql.org
Ämne: Re: SV: Refreshing materialized views

It may be simpler to just run the query from the materialized view definition as the user that you want to refresh the mv.

On Tue, Nov 28, 2017 at 10:30 PM, Daevor The Devoted <dollien@gmail.com<mailto:dollien@gmail.com>> wrote:


On 28 Nov 2017 5:18 pm, "Tom Lane" <tgl@sss.pgh.pa.us<mailto:tgl@sss.pgh.pa.us>> wrote:
Henrik Uggla <Henrik.Uggla@kristianstad.se<mailto:Henrik.Uggla@kristianstad.se>> writes:
> The underlying tables are foreign tables. The user has been mapped to a foreign user with select permission. I have no problem selecting from the foreign tables or the materialized views.

[ shrug... ] WFM; if I can select from the foreign table then I can make
a materialized view that selects from it, and that refreshes without
complaint.  Admittedly, getting things set up to select from the foreign
table is trickier than it sounds: your local user needs SELECT on the
foreign table plus a mapping to some remote userid, and *on the remote
server* that remote userid needs SELECT on whatever the foreign table
is referencing.  I'm guessing you messed up one of these components.

                        regards, tom lane

Hendrik, perhaps an easy way to check out Tom's suggestion is to create a very simple materialized view that selects just from one of the foreign tables, then attempt the REFRESH. If that works, then keep adding more tables from your original materialized view until you have found the problem.
Basically, reduce the problem to the simplest case, and if that works, then keep adding to it until you hit the problem. You may still not know why the problem is happening, but you'll at least know where to focus any further investigation.

Kind regards,
Daevor, The Devoted



--

Ben Primrose  |  Postgres DBA |  TraceLink Inc.
400 Riverpark Dr.
Floor 2, Suite 200
North Reading, MA 01864
o: +1.978.396.6507
e: bprimrose@tracelink.com<mailto:bprimrose@tracelink.com>





Message-ID: <2886758ebe314e13a73fb27f5c7d6cd4@kristianstad.se>
Permalink:  ../2886758ebe314e13a73fb27f5c7d6cd4@kristianstad.se/
Also on:    postgresql.org/message-id/2886758ebe314e13a73fb27f5c7d6cd4@kristianstad.se

 · 

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: Henrik.Uggla@kristianstad.se
  Subject: Re: Refreshing materialized views
  In-Reply-To: <2886758ebe314e13a73fb27f5c7d6cd4@kristianstad.se>
  References: <9240031180ff4c419251652f39908dd0@kristianstad.se> <13279.1511879147@sss.pgh.pa.us> <dbc16879aa424296bb1c4950c732cb57@kristianstad.se> <23154.1511882315@sss.pgh.pa.us> <CAAZnbVoxfchioGbiT5edqz+qJzJETOyLM=9EUy64aVzyCwAMqw@mail.gmail.com> <CA+OR6cTj8d4g+LLATg2QAGBjXTmF_w__tpGpJNKuFsA4_E3m7w@mail.gmail.com> <2886758ebe314e13a73fb27f5c7d6cd4@kristianstad.se>

* 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