Re: How to drop a temporary view?

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: How to drop a temporary view?
Дата
Msg-id CAHyXU0wL8MjooSEfvyT8gJ4z7yUe3goO_t433h60pjbai5JLDw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to drop a temporary view?  (Vincenzo Romano <vincenzo.romano@notorand.it>)
Ответы Re: How to drop a temporary view?
Список pgsql-general
On Fri, Apr 20, 2012 at 10:51 AM, Vincenzo Romano
<vincenzo.romano@notorand.it> wrote:
> 2012/4/20 Merlin Moncure <mmoncure@gmail.com>:
>> On Fri, Apr 20, 2012 at 10:36 AM, Vincenzo Romano
>> <vincenzo.romano@notorand.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?

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%'.

merlin

В списке pgsql-general по дате отправления:

Предыдущее
От: Vincenzo Romano
Дата:
Сообщение: Re: How to drop a temporary view?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to drop a temporary view?