view?

From: "Jose' Soares" <jose(at)sferacarta(dot)com>
To: hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: view?
Date: 1999-01-22 14:38:18
Message-ID: 36A88D5A.48434E94@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

\dv
Database = hygea
+------------------+----------------------------------+----------+
| Owner | Relation | Type |
+------------------+----------------------------------+----------+
| postgres | wattivita | view |
| postgres | wtabelle | view |
+------------------+----------------------------------+----------+

\dt
Database = hygea
+------------------+----------------------------------+----------+
| Owner | Relation | Type |
+------------------+----------------------------------+----------+
| postgres | abbattimenti | table |
| postgres | attivita | table |
| postgres | attivita_a | table |
| postgres | attivita_b | table |
| postgres | brogliacci | table |
| postgres | capi | table |
| postgres | comuni | table |
+------------------+----------------------------------+----------+

If this interests to someone there is the attached patch.

-Jose'-

Attachment Content-Type Size
psql.patch text/plain 5.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-01-22 15:19:16 Re: [HACKERS] getcwd failing suddenly
Previous Message Oleg Broytmann 1999-01-22 14:17:49 SET encoding