Re: idea: storing view source in system catalogs

Поиск
Список
Период
Сортировка
Искать
От
Hannu Krosing
Тема
Re: idea: storing view source in system catalogs
Дата
в 09:18:10
Msg-id
1211370991.7045.4.camel@huvostro
Ответ на
Список
Дерево обсуждения
idea: storing view source in system catalogs "Merlin Moncure" <mmoncure@gmail.com>
Re: idea: storing view source in system catalogs David Fetter <david@fetter.org>
Re: idea: storing view source in system catalogs Florian Pflug <fgp.phlo.org@gmail.com>
Re: idea: storing view source in system catalogs Andreas Pflug <pgadmin@pse-consulting.de>
Re: idea: storing view source in system catalogs Hannu Krosing <hannu@krosing.net>
Re: idea: storing view source in system catalogs "Merlin Moncure" <mmoncure@gmail.com>
Re: idea: storing view source in system catalogs "Robert Haas" <robertmhaas@gmail.com>
Re: idea: storing view source in system catalogs Bruce Momjian <bruce@momjian.us>
Re: idea: storing view source in system catalogs Tom Lane <tgl@sss.pgh.pa.us>
Re: idea: storing view source in system catalogs Gregory Stark <stark@enterprisedb.com>
Re: idea: storing view source in system catalogs Tom Lane <tgl@sss.pgh.pa.us>
Re: idea: storing view source in system catalogs Tom Lane <tgl@sss.pgh.pa.us>
On Wed, 2008-05-21 at 10:40 +0200, Andreas Pflug wrote:
> Florian Pflug wrote:
> >
> > 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
> 
> 
> Not the whole reason. To get a view definition that is more readable, 
> the pretty_bool option of pg_get_viewdef already does some newline and 
> indent formatting. Not the initial formatting, but Good Enough (TM), I 
> believe.
> 
> What's really lost is any comment that might have existed in the initial 
> source. I previously had the idea to invent comment nodes, but never 
> came to implement them.

Is'nt a view roughly equivalent to a SQL language FUNCTION with no
arguments and a single select.

If it is so, then I can't see, why we can store the source for functions
but not for VIEWs

like this - 

hannu=# create function viewfunc(out pg_proc) language sql as $$ select
* from pg_proc where proname = 'viewfunc' $$; 
CREATE FUNCTION
hannu=# \x
Expanded display is on.
hannu=# select * from viewfunc();
-[ RECORD 1 ]--+---------------------------------------------------
proname        | viewfunc
pronamespace   | 2200
proowner       | 10
prolang        | 14
procost        | 100
prorows        | 0
proisagg       | f
prosecdef      | f
proisstrict    | f
proretset      | f
provolatile    | v
pronargs       | 0
prorettype     | 81
proargtypes    | 
proallargtypes | {81}
proargmodes    | {o}
proargnames    | 
prosrc         |  select * from pg_proc where proname = 'viewfunc' 
probin         | -
proconfig      | 
proacl         | 

---------------
Hannu



В списке pgsql-hackers по дате отправления
От: Merlin Moncure
Дата:
От: Heikki Linnakangas
Дата:
FAQ