From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Subject: BUG #17182: Race condition on concurrent DROP and CREATE of dependent object
Date: Sat, 04 Sep 2021 06:00:00 +0000
Message-ID: <17182-a6baa001dd1784be@postgresql.org> (raw)
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, exclusion@gmail.com
Subject: Re: BUG #17182: Race condition on concurrent DROP and CREATE of dependent object
In-Reply-To: <17182-a6baa001dd1784be@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox