Dumping views as views?

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Mark Hollomon <mhh(at)mindspring(dot)com>
Subject: Dumping views as views?
Date: 2000-09-14 12:16:55
Message-ID: 3.0.5.32.20000914221655.037d4290@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


In a continuing effort to make pg_dump produce valid SQL where possible, I
would like to move away from the 'Create Table'/'Create Rule' method of
defining views, and actually dump the 'Create View' command.

This seems quite do-able, but before I start I thought I would ask if there
were any reasons people could think of for not doing this?

The approach will be:

- when getting table info, also call pg_get_viewdef (which returns 'not a
view' for non-view relations).

- When dumping rules, ignore all 'view rules'.

- Dump the 'Create View' statement in oid order as per normal.

It would be really nice if there was a simple way of detecting view rules
that was analagous to relkind. Is there a reason why this has not been
done? Has it been done?

Maybe the code that checks the rule name to see if it is a view could be
put in the backend?

----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Veatch 2000-09-14 12:31:32 Re: List funnies ?
Previous Message The Hermit Hacker 2000-09-14 12:01:50 Re: List funnies ?