Dumping views as views? - Mailing list pgsql-hackers

From Philip Warner
Subject Dumping views as views?
Date
Msg-id 3.0.5.32.20000914221655.037d4290@mail.rhyme.com.au
Whole thread Raw
In response to new relkind for view  (Mark Hollomon <mhh@mindspring.com>)
Responses Re: Dumping views as views?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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   |/


pgsql-hackers by date:

Previous
From: Zeljko Trogrlic
Date:
Subject: RE: List funnies ?
Next
From: The Hermit Hacker
Date:
Subject: Re: [GENERAL] List funnies ?