The following bug has been logged on the website:
Bug reference: 17182
Logged by: Alexander Lakhin
Email address: exclusion@gmail.com
PostgreSQL version: 14beta3
Operating system: Ubuntu 20.04
Description:
As result of the following script:
for i in `seq 100`; do
( { for n in `seq 20`; do echo "DROP DOMAIN i;"; done } | psql ) >psql1.log
2>&1 &
( echo "
CREATE DOMAIN i AS int;
CREATE FUNCTION f1() RETURNS i LANGUAGE SQL RETURN 1;
CREATE FUNCTION f2() RETURNS i LANGUAGE SQL RETURN 2;
CREATE FUNCTION f3() RETURNS i LANGUAGE SQL RETURN 3;
CREATE FUNCTION f4() RETURNS i LANGUAGE SQL RETURN 4;
CREATE FUNCTION f5() RETURNS i LANGUAGE SQL RETURN 5;
" | psql ) >psql2.log 2>&1 &
wait
psql -c "DROP DOMAIN i CASCADE" >psql3.log 2>&1
done
I get several broken functions with the invalid return type:
SELECT f1()
ERROR: cache lookup failed for type 16519
CONTEXT: SQL function "f1" during inlining
\df
ERROR: cache lookup failed for type 16519
(\df is effectively unusable when such functions exist)
SELECT pp.oid, proname, pronamespace, proowner, prolang, prorettype FROM
pg_proc pp INNER JOIN pg_namespace pn ON (pp.pronamespace = pn.oid) WHERE
pn.nspname='public'
oid | proname | pronamespace | proowner | prolang | prorettype
-------+---------+--------------+----------+---------+------------
16520 | f1 | 2200 | 10 | 14 | 16519
16521 | f2 | 2200 | 10 | 14 | 16519
16564 | f3 | 2200 | 10 | 14 | 16563
16565 | f4 | 2200 | 10 | 14 | 16563
16616 | f5 | 2200 | 10 | 14 | 16615
(5 rows)
The similar behaviour is reproduced with "CREATE SCHEMA s; CREATE FUNCTION
s.funcX ... / DROP SCHEMA s;", but \df *.func* shows such functions with the
empty schema column.