Re: How to drop a temporary view? - Mailing list pgsql-general

From Tom Lane
Subject Re: How to drop a temporary view?
Date
Msg-id 8620.1334938026@sss.pgh.pa.us
Whole thread Raw
In response to Re: How to drop a temporary view?  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: How to drop a temporary view?  (Vincenzo Romano <vincenzo.romano@notorand.it>)
Re: How to drop a temporary view?  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
Merlin Moncure <mmoncure@gmail.com> writes:
> On Fri, Apr 20, 2012 at 10:51 AM, Vincenzo Romano
> <vincenzo.romano@notorand.it> wrote:
>> Ok. That works. How can I know if there's a temporary view with the
>> same name in my session?

> well, arguably you should already know somehow.  but if you don't,
> query information_schema.views for a table_name with a table_schema
> LIKE 'pg_temp%'.

Not sure that is safe --- won't the info schema also show temp views
of other sessions?

You might be able to use "DROP VIEW pg_temp.foo", which will either
drop a temp view of your own session or throw an error if there is none.

            regards, tom lane

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: How to drop a temporary view?
Next
From: Eliot Gable
Date:
Subject: Re: pg_advisory_lock() and row deadlocks