Re: idea: storing view source in system catalogs
От | Florian Pflug |
---|---|
Тема | Re: idea: storing view source in system catalogs |
Дата | |
Msg-id | 48335C1F.5060807@gmail.com обсуждение исходный текст |
Ответ на | Re: idea: storing view source in system catalogs (David Fetter <david@fetter.org>) |
Ответы |
Re: idea: storing view source in system catalogs
|
Список | pgsql-hackers |
David Fetter wrote: > On Tue, May 20, 2008 at 02:03:17PM -0400, Merlin Moncure wrote: >> I wonder if there is any merit to the idea of storing the 'create >> view' statement that created the view in an appropriate place. >> There are basically two reasons for this: > > +1 for DDL in general, including the original CREATE and appending all > subsequent ALTERs. DROP would have to make the thing go away. I > suppose CREATE OR REPLACE would also wipe the earlier versions, but > I'm not married to to that idea. The 1000$ question is how to deal with renames, though. Not of view itself, but of the tables it depends on. Currently, the view tracks those renames (which is an important feature, IMHO), and you get the correct (using the new names) SQL when dumping the view. Anything that stores the original statement, but fails to track renames is more confusing that what it's worth, I think... But maybe you could store the whitespace appearing before (or after?) a token in the parse tree that is stored for a view. That might not allow reconstructing the *precise* statement, but at least the reconstructed statement would preserve newlines and indention - which probably is the whole reason for wanting to store the original statement in the first place, no? I have no idea how hard I'd be to carry that information from the lexer into the parser, and then into whatever representation we use for storing a view, though... regards, Florian Pflug
В списке pgsql-hackers по дате отправления: