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?