Re: Bug in pg_dump

From: Christian Ullrich <chris(at)chrullrich(dot)net>
To: Joel Jacobson <joel(at)gluefinance(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bug in pg_dump
Date: 2011-01-13 10:55:06
Message-ID: 4D2EDA0A.8060104@chrullrich.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Joel Jacobson wrote:

> The example from Tom Lane below results in a database which is not
> possible to correctly dump using pg_dump.
>
> The view v1 strangely becomes a table in the dump output?!

This is no bug, it's a feature (tm).

pg_dump is clever enough to detect the circular dependency and break it
open by creating v1 in two steps.

A view in PostgreSQL is simply an empty table with an ON SELECT DO
INSTEAD rule named "_RETURN" on it. pg_dump first creates the empty
table, then view v2 depending on that table, and finally the _RETURN
rule turning v1 into a view and reintroducing the circular dependency.

--
Christian

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-01-13 10:59:47 Re: libpq documentation cleanups (repost 3)
Previous Message Robert Haas 2011-01-13 10:49:04 Re: Bug in pg_describe_object, patch v2