Re: Listing views

From: Olivier Guilyardi <ml(at)xung(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Listing views
Date: 2004-08-10 12:35:47
Message-ID: 4118C123.7000409@xung.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

ra(at)konvergencia(dot)hu wrote:
> On Tuesday 10 August 2004 03:14, Olivier Guilyardi wrote:
>
>>SELECT viewname FROM pg_views WHERE viewname !~ '^pg_';
>
> with 7.4 :
>
> SELECT viewname FROM pg_views WHERE schemaname NOT IN
> ('pg_catalog','information_schema');

For me, the best is an identical query for both 7.2 and 7.4. Since
the pg_views schemaname field does not exist in 7.2, this last query
is going to raise an error.

Let's take, say :
SELECT viewname FROM pg_views
WHERE schemaname NOT IN ('pg_catalog','information_schema')
AND viewname !~ '^pg_';

Is there an SQL trick so that this does not raise an error in 7.2 ?
Something like IF FIELD EXISTS (this is pseudo-code) ?
--
og

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2004-08-10 12:55:41 Re: Listing views
Previous Message Peter Eisentraut 2004-08-10 12:34:54 Re: nested transaction