Re: [HACKERS] view?

From: jwieck(at)debis(dot)com (Jan Wieck)
To: jose(at)sferacarta(dot)com (Jose' Soares)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] view?
Date: 1999-01-22 16:52:43
Message-ID: m103jp7-000EBQC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jose' Soares wrote:

> Hi,
>
> Currently psql show views like:
>
> Database = hygea
> +------------------+----------------------------------+----------+
> | Owner | Relation | Type |
> +------------------+----------------------------------+----------+
> | postgres | abbattimenti | table |
> | postgres | wattivita | view? |
> | postgres | attivita_a | table |
>
> because it seeks for relhasrules field and if you have a table (not a
> table) with a rule it thinks it is a view
> and displays "view?" instead of "table".
>
> I modified psql.c to use pg_get_viewdef() function to seek for views and
> now I can display only tables using \dt
> or only views using \dv like:hygea=> \dv
> [...]

I suggest not to apply this patch

1. The function pg_get_viewdef() is definitely too much
overhead. In fact it must parse back the complete view
definition, doing many system table lookups, just to tell
if this is a view or not.

2. The function pg_get_viewdef() is currently out of sync
with the possible parsetrees for rule actions. CASE (and
maybe some other constructs) aren't implemented and if it
hit's on such a rule it will elog() out.

Rules on SELECT event are restricted totally to view rules
since v6.4. There can be only one rule on SELECT that is
INSTEAD and selects exactly the attributes on one table. And
AFAIC this restriction will stay. The check should be if
there is a rule with event SELECT --> view.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck(at)debis(dot)com (Jan Wieck) #

In response to

  • view? at 1999-01-22 14:38:18 from Jose' Soares

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-01-22 16:57:44 Re: [HACKERS] Alpha Size (size_t) != int problem
Previous Message Matthias Schmitt 1999-01-22 16:49:13 RE: developer's guide?