From: | Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to drop a temporary view? |
Date: | 2012-04-20 16:38:45 |
Message-ID: | CAHjZ2x43HEopPD4RojxOBW7UGETjYpvdUx4p5vF8HqgizKESAA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2012/4/20 Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>:
> 2012/4/20 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> 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
>
> Cool! It works, despite my temporary schema should be now pg_temp_29!
> It's at chapter 18.11.1 (my fault for not searching enough).
>
> Thanks a lot Tom.
It works only if you have created at least one temporary object.
Until that the pg_temp "meta schema" doesn't resolve to a real schema
and the exception is thrown!
It's a cool thing anyway!
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-04-20 16:43:51 | Re: How to drop a temporary view? |
Previous Message | Vincenzo Romano | 2012-04-20 16:26:56 | Re: How to drop a temporary view? |