Обсуждение: If there are more than two functions in different schemas, the functions have the same name and same arguments, \df[+] only display the function that schema first appeared in the search_path.
Hi,
I find if there are more than one functions in different schemas,
and the functions have the same name and the same arguments,
\df[+] only display the function that schema earlier appeared in the search_path.
And SELECT pg_function_is_visible(funoid) returns f.
CREATE OR REPLACE FUNCTION fun1(arg1 INT, arg2 OUT int, arg3 IN OUT int)
RETURNS RECORD
AS
$$
BEGIN
arg3 := arg1 + arg2;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE PROCEDURE proc1(arg1 INT, arg2 IN OUT INT, arg3 OUT INT)
AS
$$
BEGIN
arg3 := arg1 + arg2;
END;
$$ LANGUAGE plpgsql;
postgres=# \df
List of functions
Schema | Name | Result data type | Argument data types | Type
--------+-------+------------------+-------------------------------------------------------+------
public | fun1 | record | arg1 integer, OUT arg2 integer, INOUT arg3 integer | func
public | proc1 | | IN arg1 integer, INOUT arg2 integer, OUT arg3 integer | proc
(2 rows)
set search_path="$user", public, s1;
CREATE SCHEMA s1;
CREATE OR REPLACE FUNCTION s1.fun1(arg1 INT, arg2 OUT int, arg3 IN OUT int)
RETURNS RECORD
AS
$$
BEGIN
arg3 := arg1 + arg2;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE PROCEDURE s1.proc1(arg1 INT, arg2 IN OUT INT, arg3 OUT INT)
AS
$$
BEGIN
arg3 := arg1 + arg2;
END;
$$ LANGUAGE plpgsql;
postgres=# \df
List of functions
Schema | Name | Result data type | Argument data types | Type
--------+-------+------------------+-------------------------------------------------------+------
public | fun1 | record | arg1 integer, OUT arg2 integer, INOUT arg3 integer | func
public | proc1 | | IN arg1 integer, INOUT arg2 integer, OUT arg3 integer | proc
(2 rows)
postgres=# \df fun1
List of functions
Schema | Name | Result data type | Argument data types | Type
--------+------+------------------+----------------------------------------------------+------
public | fun1 | record | arg1 integer, OUT arg2 integer, INOUT arg3 integer | func
postgres=# \df fun1
List of functions
Schema | Name | Result data type | Argument data types | Type
--------+------+--------------
----+------------------------- ---------------------------+-- ---- public | fun1 | record | arg1 integer, OUT arg2 integer, INOUT arg3 integer | func
(1 row)
postgres=# SELECT pg_function_is_visible(16386);pg_function_is_visible------------------------t(1 row)
postgres=# SELECT pg_function_is_visible(16389);--Should display t? pg_function_is_visible------------------------f(1 row)