Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ugmJ9-007G11-Ex for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Jul 2025 15:32:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ugmJ8-002VE6-Da for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Jul 2025 15:32:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ugmJ8-002VDx-4j for pgsql-bugs@lists.postgresql.org; Tue, 29 Jul 2025 15:32:02 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ugmJ5-001VX7-0s for pgsql-bugs@lists.postgresql.org; Tue, 29 Jul 2025 15:32:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 56TFVx4Q998273; Tue, 29 Jul 2025 11:31:59 -0400 From: Tom Lane To: cgopal@onezero.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19001: PostgreSQL 17: CREATE MATERIALIZED VIEW fails with STABLE function using JSONB LATERAL joins In-reply-to: <19001-efdb4ac1eaddc5b8@postgresql.org> References: <19001-efdb4ac1eaddc5b8@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 29 Jul 2025 13:55:07 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <998271.1753803119.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Tue, 29 Jul 2025 11:31:59 -0400 Message-ID: <998272.1753803119@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > In PostgreSQL 17, I’m encountering an error when creating a MATERIALIZED > VIEW that uses a STABLE function returning jsonb, followed by LATERAL joins > using jsonb_each() and jsonb_to_record(). > The view creation fails with: > ERROR: relation "test_table" does not exist What this looks like is a search_path problem. Per the first incompatibility point in the v17 release notes, materialized view refresh now runs the view query with a "safe" search_path that doesn't include the public schema. So you need to schema-qualify that reference, or else modify the function to use a "SET search_path" clause. regards, tom lane