Re: How to drop a temporary view?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to drop a temporary view?
Date: 2012-04-20 16:07:06
Message-ID: 8620.1334938026@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
> On Fri, Apr 20, 2012 at 10:51 AM, Vincenzo Romano
> <vincenzo(dot)romano(at)notorand(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Eliot Gable 2012-04-20 16:25:22 Re: pg_advisory_lock() and row deadlocks
Previous Message Merlin Moncure 2012-04-20 15:59:13 Re: How to drop a temporary view?