Re: BUG #17161: Assert failed on opening a relation that exists in two schemas via the LANGUAGE SQL function - Mailing list pgsql-bugs

From Alexander Lakhin
Subject Re: BUG #17161: Assert failed on opening a relation that exists in two schemas via the LANGUAGE SQL function
Date
Msg-id 25f71277-c45a-8ef2-ef9a-9054c3d6e0b0@gmail.com
Whole thread Raw
In response to BUG #17161: Assert failed on opening a relation that exists in two schemas via the LANGUAGE SQL function  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17161: Assert failed on opening a relation that exists in two schemas via the LANGUAGE SQL function  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17163: spgist index scan statistics stays at 0
Next
From: Yongqian Li
Date:
Subject: Unexpected behavior from using default config value