From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | cgopal(at)onezero(dot)com, 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:34:21 |
Message-ID: | 713b3a6c6bbac7329b7d58038d47b5361d3ff2e4.camel@cybertec.at |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tue, 2025-07-29 at 13:55 +0000, PG Bug reporting form wrote:
> PostgreSQL version: 17.5
> Operating system: Debian (Docker - postgres:latest) on WSL2 / Window
> Description:
>
> 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
>
> However, the referenced table does exist, and the function used in the view
> creation runs fine standalone.
>
> The same view definition works correctly in PostgreSQL 13
That must be a consequence of the tightened security, see the first entry in
https://www.postgresql.org/docs/current/release-17.html#RELEASE-17-MIGRATION
Your function is not defined correctly. Set a "search_path" like this:
ALTER FUNCTION yourfunc SET search_path = schema_containing_test_table;
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2025-07-29 19:11:03 | BUG #19002: `pg_isready` unexpectedly succeeds on incorrect `--dbname` and/or `--username` |
Previous Message | Tom Lane | 2025-07-29 15:31:59 | Re: BUG #19001: PostgreSQL 17: CREATE MATERIALIZED VIEW fails with STABLE function using JSONB LATERAL joins |