Re: BUG #19001: PostgreSQL 17: CREATE MATERIALIZED VIEW fails with STABLE function using JSONB LATERAL joins

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: cgopal(at)onezero(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19001: PostgreSQL 17: CREATE MATERIALIZED VIEW fails with STABLE function using JSONB LATERAL joins
Date: 2025-07-29 15:31:59
Message-ID: 998272.1753803119@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Laurenz Albe 2025-07-29 15:34:21 Re: BUG #19001: PostgreSQL 17: CREATE MATERIALIZED VIEW fails with STABLE function using JSONB LATERAL joins
Previous Message PG Bug reporting form 2025-07-29 13:55:07 BUG #19001: PostgreSQL 17: CREATE MATERIALIZED VIEW fails with STABLE function using JSONB LATERAL joins