Re: Bug in pg_dump - Mailing list pgsql-hackers

From Christian Ullrich
Subject Re: Bug in pg_dump
Date
Msg-id 4D2EDA0A.8060104@chrullrich.net
Whole thread Raw
In response to Bug in pg_dump  (Joel Jacobson <joel@gluefinance.com>)
List 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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pg_primary_conninfo
Next
From: Robert Haas
Date:
Subject: Re: pg_ctl failover Re: Latches, signals, and waiting