From: Tom Lane <tgl@sss.pgh.pa.us>
To: Keith Fiske <keith@omniti.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: schema-only pg_dump inconsistently dumps some view definitions
Date: Mon, 30 Nov 2015 18:09:25 -0500
Message-ID: <26994.1448924965@sss.pgh.pa.us> (raw)
In-Reply-To: <CAG1_KcADdUUDp+DjLHH0Y-=J0yHEgU-f2xEZYJdMtK3db_FeyQ@mail.gmail.com>
References: <CAG1_KcADdUUDp+DjLHH0Y-=J0yHEgU-f2xEZYJdMtK3db_FeyQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Keith Fiske <keith@omniti.com> writes:
> Ran into a weird issue with pg_dump outputting an odd definition for a
> view. First, the view definition
> https://gist.github.com/keithf4/24298f7327b4a27054fd
> If a pg_dump -s or pg_dumpall -s for the entire database is used, it
> outputs the view definition as a table with an ALTER TABLE statement
> related to logical replication followed by the "_RETURN" rule later on in
> the dump file.
pg_dump does that when it's trying to break a circular dependency;
that is, there is something referenced in the view definition that
cannot be defined before the view exists. The typical thing I've
seen is a view defined in terms of a function that takes or returns
the view's named rowtype.
It's not real clear why it's doing it here, though if you can submit
a self-contained test case we could take a look. I suspect though
that the answer will be "not a bug".
There's been some speculation about revising pg_dump so that what
it puts out in such cases involves a dummy view definition followed
later by CREATE OR REPLACE VIEW. No one's gotten around to writing
a patch for that though, and I rather imagine that it would break
unsuspecting tools anyway :-(
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: tgl@sss.pgh.pa.us, keith@omniti.com
Subject: Re: schema-only pg_dump inconsistently dumps some view definitions
In-Reply-To: <26994.1448924965@sss.pgh.pa.us>
References: <CAG1_KcADdUUDp+DjLHH0Y-=J0yHEgU-f2xEZYJdMtK3db_FeyQ@mail.gmail.com> <26994.1448924965@sss.pgh.pa.us>
* 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