Re: Mirroring a DB

Peter Eisentraut <peter_e@gmx.net>

From: Peter Eisentraut <peter_e@gmx.net>
To: Karl DeBisschop <kdebisschop@range.infoplease.com>
Cc: swalton@galileo.csun.edu, pgsql-general@postgresql.org
Date: 1999-12-11T02:00:12Z
Lists: pgsql-hackers
On 1999-12-10, Karl DeBisschop mentioned:

>  pg_dump -o -h <live> <table> | psql -h <mirror> <table>
> 
> This generally works, but has a habit recreating the views as actual
> tables.  Often you can live with this, and there may be a simple way
> to prevent it.  I just haven't found one yet.

I view *is* a table, with a ON SELECT rule on it. So writing

CREATE TABLE foo ( ... );
CREATE RULE _RETfoo AS ON SELECT DO INSTEAD SELECT your_stuff_here;

is equivalent to

CREATE VIEW foo AS SELECT your_stuff_here;

Perhaps it would be nicer if the dump contained the second version, but
you're not supposed to read these dumps (in case you didn't know :).

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden