pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Lakhin <exclusion@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17161: Assert failed on opening a relation that exists in two schemas via the LANGUAGE SQL function
Date: Sat, 28 Aug 2021 19:59:08 +0300
Message-ID: <25f71277-c45a-8ef2-ef9a-9054c3d6e0b0@gmail.com> (raw)
In-Reply-To: <17161-048a1cdff8422800@postgresql.org>
References: <17161-048a1cdff8422800@postgresql.org>

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





view thread (5+ messages)  latest in thread

Message-ID: <25f71277-c45a-8ef2-ef9a-9054c3d6e0b0@gmail.com>
Permalink:  ../25f71277-c45a-8ef2-ef9a-9054c3d6e0b0@gmail.com/
Also on:    postgresql.org/message-id/25f71277-c45a-8ef2-ef9a-9054c3d6e0b0@gmail.com

 · 

reply

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: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17161: Assert failed on opening a relation that exists in two schemas via the LANGUAGE SQL function
  In-Reply-To: <25f71277-c45a-8ef2-ef9a-9054c3d6e0b0@gmail.com>

* 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