pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: felix.buenemann@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #12766: Dump/Load of Materialized View with inlined SQL function fails
Date: Fri, 13 Feb 2015 00:00:55 +0000
Message-ID: <20150213000055.2584.16773@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      12766
Logged by:          Felix Buenemann
Email address:      felix.buenemann@gmail.com
PostgreSQL version: 9.4.1
Operating system:   Mac OS X 10.10.2
Description:        

pg_dump dumps materialized views in the wrong order, if the view is
alphabetically sorted before a table that it references indirectly through a
stored procedure in sql language.

The reason seems to be that pg_dump does not know about the indirect
dependency of the matview, so it doesn't reorder the tables/matviews
properly.

This leads to errors like this on restore:

psql:foo.sql:43: ERROR:  relation "foo" does not exist
LINE 1:  SELECT label FROM foo WHERE id = value;
                           ^
QUERY:   SELECT label FROM foo WHERE id = value;
CONTEXT:  SQL function "foo_label" during inlining

Problematic dump from error above:
https://gist.github.com/056f157a200e334dc5b0

Minimal testcase (thanks to RhodiumToad on IRC):
http://pgsql.privatepaste.com/cc80393e25


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)  latest in thread

Message-ID: <20150213000055.2584.16773@wrigleys.postgresql.org>
Permalink:  ../20150213000055.2584.16773@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20150213000055.2584.16773@wrigleys.postgresql.org

 · 

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-bugs@postgresql.org
  Cc: felix.buenemann@gmail.com
  Subject: Re: BUG #12766: Dump/Load of Materialized View with inlined SQL function fails
  In-Reply-To: <20150213000055.2584.16773@wrigleys.postgresql.org>
  References: <20150213000055.2584.16773@wrigleys.postgresql.org>

* 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