Skip site navigation (1) Skip section navigation (2)

Re: How to drop a temporary view?

From: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to drop a temporary view?
Date: 2012-04-20 15:51:03
Message-ID: CAHjZ2x5NHOoEG3cTGe+H60r6fxcthNhjEFEyGjqCmUaFkzqxnw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
2012/4/20 Merlin Moncure <mmoncure(at)gmail(dot)com>:
> On Fri, Apr 20, 2012 at 10:36 AM, Vincenzo Romano
> <vincenzo(dot)romano(at)notorand(dot)it> wrote:
>> Hi all.
>> I'd like use a temporary view "to hide" a non-temp one  for some queries.
>> Later I'd need to drop that view in order to "revert to normal operations".
>> As there is no "DROP TEMPORARY VIEW ..." I'd be forced to "CREATE OR
>> REPLACE TEMPORARY VIEW ..." in order to "overwrite" the temporary one
>> with the same code as the non-temporary.
>> All this sounds quite complex to me. Is there a way to drop temporary
>> stuff before closing the session?
>> TIA.
>
> you can do it with vanilla DROP VIEW:
>
> postgres=# create temp view t as select 1;
> CREATE VIEW
> postgres=# drop view t;
> DROP VIEW
>
> merlin

Ok. That works. How can I know if there's a temporary view with the
same name in my session?

In response to

Responses

pgsql-general by date

Next:From: Merlin MoncureDate: 2012-04-20 15:59:13
Subject: Re: How to drop a temporary view?
Previous:From: Chris AngelicoDate: 2012-04-20 15:46:28
Subject: Re: pg_advisory_lock() and row deadlocks

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group