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

Поиск
Список
Период
Сортировка
От Vincenzo Romano
Тема And what about temporary functions? (Was: How to drop a temporary view?)
Дата
Msg-id CAHjZ2x4xf6rrX62iu-Nk4eFWE0CLnP4rC6+zC1rSYBUVNsYOAw@mail.gmail.com
обсуждение исходный текст
Ответы Re: And what about temporary functions? (Was: How to drop a temporary view?)
Список pgsql-general
2012/4/20 Tom Lane <tgl@sss.pgh.pa.us>:
> Vincenzo Romano <vincenzo.romano@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 happening.
>
>                        regards, tom lane

It looks like it works like this:

-- session 1
create or replace function pg_temp.f( out i int )
volatile
language plpgsql
as $l0$
begin
  i := 42;
end;
$l0$;
-- session 2
create or replace function pg_temp.f( out i int )
volatile
language plpgsql
as $l0$
begin
  i := 0;
end;
$l0$;
-- session 1
tmp1=# SELECT * from f();
ERROR:  function f() does not exist
LINE 1: SELECT * from f();
                      ^
HINT:  No function matches the given name and argument types. You
might need to add explicit type casts.
tmp1=# SELECT * from pg_temp.f();
 i
----
 42
(1 row)

Time: 0,301 ms

-- session 2
tmp1=# SELECT * from f();
ERROR:  function f() does not exist
LINE 1: SELECT * from f();
                      ^
HINT:  No function matches the given name and argument types. You
might need to add explicit type casts.
tmp1=# SELECT * from pg_temp.f();
 i
---
 0
(1 row)

Time: 0,252 ms
--

Why not using the implicit pg_temp_nnn as seen in views and tables?

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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: pg_basebackup issues
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: pgstat wait timeout