From: Tom Lane <tgl@sss.pgh.pa.us>
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
Date: Tue, 29 Jul 2025 11:31:59 -0400
Message-ID: <998272.1753803119@sss.pgh.pa.us> (raw)
In-Reply-To: <19001-efdb4ac1eaddc5b8@postgresql.org>
References: <19001-efdb4ac1eaddc5b8@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> 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
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: tgl@sss.pgh.pa.us, cgopal@onezero.com, 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: <998272.1753803119@sss.pgh.pa.us>
* 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