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

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] create rule changes table to view ?
Date: 1999-09-24 10:37:24
Message-ID: Pine.LNX.4.10.9909240005280.18581-100000@peter-e.yi.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have noticed and lived with this problem for quite a while.

There's nothing in pg_class that tells a table from a view, they're both
"relations". Since a view is implemented as in effect an empty table with
on select rules on it, psql thinks every table with a rule on it is a
view. This is just the output, nothing on the table changes.

A fix would be to display both tables and views as "relation". As far as I
know there is now 100% deterministic way to tell a table from a view. I
think one fine day Jan is going to change that but for now we don't have
to worry about it.

Peter

On Sep 23, Bruce Momjian mentioned:

> Can someone comment on this?
>
> > 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(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
> > phone: +007(095)939-16-83, +007(095)939-23-83
> >
> >
> >
>
>
>

--
Peter Eisentraut - peter_e(at)gmx(dot)net
http://yi.org/peter-e

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 1999-09-24 10:38:19 psql issues
Previous Message Hiroshi Inoue 1999-09-24 09:45:38 RE: [HACKERS] couldn't rollback cache ?