Re: BUG #17161: Assert failed on opening a relation that exists in two schemas via the LANGUAGE SQL function
Alexander Law <exclusion@gmail.com>
From: Alexander Lakhin <exclusion@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Date: 2021-08-28T16:59:08Z
Lists: pgsql-bugs
25.08.2021 23:00, PG Bug reporting form wrote: > The following bug has been logged on the website: > > Bug reference: 17161 > Logged by: Alexander Lakhin > Email address: exclusion@gmail.com > PostgreSQL version: 14beta3 > Operating system: Ubuntu 20.04 > Description: > > When executing the following query (based on the create_function_3 test): > CREATE TABLE functest2 (a int, b int); > > CREATE SCHEMA temp_func_test; > SET search_path TO temp_func_test, public; > CREATE TABLE functest2 (a int, b int); > > CREATE FUNCTION functest_sri1() RETURNS SETOF int > LANGUAGE SQL > STABLE > RETURN (SELECT count(a) FROM functest2); > > SELECT * FROM functest_sri1(); > My initial conclusion was incorrect. Duplicate relation is not needed in the second schema. It's sufficient to just change search_path to another schema: CREATE TABLE functest2 (a int, b int); CREATE SCHEMA temp_func_test; SET search_path TO temp_func_test, public; CREATE FUNCTION functest_sri1() RETURNS SETOF int LANGUAGE SQL STABLE RETURN (SELECT count(a) FROM functest2); SELECT * FROM functest_sri1(); Best regards, Alexander
Commits
-
Fix missed lock acquisition while inlining new-style SQL functions.
- 983d7033df6e 14.0 landed
- 589be6f6c732 15.0 landed