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

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17161: Assert failed on opening a relation that exists in two schemas via the LANGUAGE SQL function
Date: 2021-08-28 16:59:08
Message-ID: 25f71277-c45a-8ef2-ef9a-9054c3d6e0b0@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Yongqian Li 2021-08-29 01:04:28 Unexpected behavior from using default config value
Previous Message Tom Lane 2021-08-27 22:48:46 Re: BUG #17163: spgist index scan statistics stays at 0