Re: [HACKERS] create rule changes table to view ?

Поиск
Список
Период
Сортировка
От José Soares
Тема Re: [HACKERS] create rule changes table to view ?
Дата
Msg-id 37EB7A78.A5AA913@sferacarta.com
обсуждение исходный текст
Ответ на Re: [HACKERS] create rule changes table to view ?  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers

Bruce Momjian ha scritto:

> Can someone comment on this?

This an old question.
psql suppose that table "test" is a view because it checks for  pg_class.relhasrules and it prints "view?"
if the value is TRUE and the value is if there's a rule for the table.
The only way to distinguish a table from a view is the pg_get_viewdef.

Some time ago I suggested to use  pg_get_viewdef('tablename') to check for views
to print "view or table" instead of "view?".
I made a patch to my psql and it now recognize views perfectly and I can display
only tables using \d and/or only views using \v

Comments.


>
>
> > I just began to learn rules with 6.5 and notice:
> > test=> \dt
> > Database    = test
> >  +------------------+----------------------------------+----------+
> >  |  Owner           |             Relation             |   Type   |
> >  +------------------+----------------------------------+----------+
> >  | megera           | access_log                       | table    |
> >  | megera           | hits                             | table    |
> >  | megera           | junk_qwerty                      | table    |
> >  +------------------+----------------------------------+----------+
> >
> > test=>  create rule log_hits as on update to hits  do instead insert into hits values ( NEW.msg_id, 1);
> > CREATE
> > test=> \dt
> > Database    = test
> >  +------------------+----------------------------------+----------+
> >  |  Owner           |             Relation             |   Type   |
> >  +------------------+----------------------------------+----------+
> >  | megera           | access_log                       | table    |
> >  | megera           | hits                             | view?    |
> >  | megera           | junk_qwerty                      | table    |
> >  +------------------+----------------------------------+----------+
> >
> > Table hits now becomes view ?
> >
> >
> >       Regards,
> >
> >               Oleg
> >
> > _____________________________________________________________
> > Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
> > Sternberg Astronomical Institute, Moscow University (Russia)
> > Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
> > phone: +007(095)939-16-83, +007(095)939-23-83
> >
> >
> >
>
> --
>   Bruce Momjian                        |  http://www.op.net/~candle
>   maillist@candle.pha.pa.us            |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
>
> ************



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Daniel Péder
Дата:
Сообщение: postgres startup script modification (Linux RedHat)
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: [HACKERS] Re: [GENERAL] Update of bitmask type