[GENERAL] How to drop a temporary view?

2012-04-20 Thread Vincenzo Romano
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

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Rodrigo Gonzalez
On Fri, 20 Apr 2012 17:36:59 +0200 Vincenzo Romano vincenzo.rom...@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

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Merlin Moncure
On Fri, Apr 20, 2012 at 10:36 AM, Vincenzo Romano vincenzo.rom...@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

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Vincenzo Romano
2012/4/20 Merlin Moncure mmonc...@gmail.com: On Fri, Apr 20, 2012 at 10:36 AM, Vincenzo Romano vincenzo.rom...@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

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Merlin Moncure
On Fri, Apr 20, 2012 at 10:51 AM, Vincenzo Romano vincenzo.rom...@notorand.it wrote: 2012/4/20 Merlin Moncure mmonc...@gmail.com: On Fri, Apr 20, 2012 at 10:36 AM, Vincenzo Romano vincenzo.rom...@notorand.it wrote: Hi all. I'd like use a temporary view to hide a non-temp one  for some

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Tom Lane
Merlin Moncure mmonc...@gmail.com writes: On Fri, Apr 20, 2012 at 10:51 AM, Vincenzo Romano vincenzo.rom...@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,

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Vincenzo Romano
2012/4/20 Tom Lane t...@sss.pgh.pa.us: Merlin Moncure mmonc...@gmail.com writes: On Fri, Apr 20, 2012 at 10:51 AM, Vincenzo Romano vincenzo.rom...@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

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Vincenzo Romano
2012/4/20 Vincenzo Romano vincenzo.rom...@notorand.it: 2012/4/20 Tom Lane t...@sss.pgh.pa.us: Merlin Moncure mmonc...@gmail.com writes: On Fri, Apr 20, 2012 at 10:51 AM, Vincenzo Romano vincenzo.rom...@notorand.it wrote: Ok. That works. How can I know if there's a temporary view with the

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Tom Lane
Vincenzo Romano vincenzo.rom...@notorand.it writes: 2012/4/20 Vincenzo Romano vincenzo.rom...@notorand.it: 2012/4/20 Tom Lane t...@sss.pgh.pa.us: 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. It

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Merlin Moncure
On Fri, Apr 20, 2012 at 11:07 AM, Tom Lane t...@sss.pgh.pa.us wrote: Merlin Moncure mmonc...@gmail.com writes: 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 ---

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Vincenzo Romano
2012/4/20 Tom Lane t...@sss.pgh.pa.us: Vincenzo Romano vincenzo.rom...@notorand.it writes: 2012/4/20 Vincenzo Romano vincenzo.rom...@notorand.it: 2012/4/20 Tom Lane t...@sss.pgh.pa.us: You might be able to use DROP VIEW pg_temp.foo, which will either drop a temp view of your own session or

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Vincenzo Romano
2012/4/20 Vincenzo Romano vincenzo.rom...@notorand.it: 2012/4/20 Tom Lane t...@sss.pgh.pa.us: Vincenzo Romano vincenzo.rom...@notorand.it writes: 2012/4/20 Vincenzo Romano vincenzo.rom...@notorand.it: 2012/4/20 Tom Lane t...@sss.pgh.pa.us: You might be able to use DROP VIEW pg_temp.foo, which

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Vincenzo Romano
2012/4/20 Vincenzo Romano vincenzo.rom...@notorand.it: 2012/4/20 Vincenzo Romano vincenzo.rom...@notorand.it: 2012/4/20 Tom Lane t...@sss.pgh.pa.us: Vincenzo Romano vincenzo.rom...@notorand.it writes: 2012/4/20 Vincenzo Romano vincenzo.rom...@notorand.it: 2012/4/20 Tom Lane

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Tom Lane
Vincenzo Romano vincenzo.rom...@notorand.it writes: As you can see, the third time I get a NOTICE message I don't get the first two times. Everything works fine but this strange thing... There's a typo (extra create temporary view), Sorry, Hm, yeah, the first time would throw an error

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Vincenzo Romano
2012/4/20 Tom Lane t...@sss.pgh.pa.us: Vincenzo Romano vincenzo.rom...@notorand.it writes: As you can see, the third time I get a NOTICE message I don't get the first two times. Everything works fine but this strange thing... There's a typo (extra create temporary view), Sorry, Hm, yeah,

Re: [GENERAL] How to drop a temporary view?

2012-04-20 Thread Tom Lane
Vincenzo Romano vincenzo.rom...@notorand.it writes: The weirdness is that it doesn't produce any notice the first two times. At the third invocation I see the notice coming out. I'd suggest tweaking the exception handler to print the error it caught; that would probably clarify what is

And what about temporary functions? (Was: [GENERAL] How to drop a temporary view?)

2012-04-20 Thread Vincenzo Romano
2012/4/20 Tom Lane t...@sss.pgh.pa.us: Vincenzo Romano vincenzo.rom...@notorand.it writes: The weirdness is that it doesn't produce any notice the first two times. At the third invocation I see the notice coming out. I'd suggest tweaking the exception handler to print the error it caught;

Re: And what about temporary functions? (Was: [GENERAL] How to drop a temporary view?)

2012-04-20 Thread Tom Lane
Vincenzo Romano vincenzo.rom...@notorand.it writes: Why not using the implicit pg_temp_nnn as seen in views and tables? That's intentional, it was considered too much of a security risk to let temporary functions mask normal ones. regards, tom lane -- Sent via