Re: schema-only pg_dump inconsistently dumps some view definitions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: schema-only pg_dump inconsistently dumps some view definitions
Дата
Msg-id 26994.1448924965@sss.pgh.pa.us
обсуждение исходный текст
Ответ на schema-only pg_dump inconsistently dumps some view definitions  (Keith Fiske <keith@omniti.com>)
Список pgsql-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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Keith Fiske
Дата:
Сообщение: Re: schema-only pg_dump inconsistently dumps some view definitions
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: BUG #13746: SQL Query Window stopped working