Re: BUG #18813: Materialized view creation regression when inlining recursive SQL function

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: zeograd(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18813: Materialized view creation regression when inlining recursive SQL function
Date: 2025-02-16 16:24:36
Message-ID: d90a451aa1f7af0c4ad8e05f6523f4ed57499c14.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, 2025-02-16 at 15:49 +0000, PG Bug reporting form wrote:
> I've encountered an error when creating a materialized view as I updated
> its body by introducing a recursive function.
>
> On postgreSQL 16, it works as expected: the materialized view is created and
> works as intended.
> Starting from posgreSQL 17.0, the materialized view created failed with the
> error message
>
> ERROR:  function jsonb_recursive_merge(jsonb, jsonb) does not exist
> LINE 9:                    ELSE jsonb_recursive_merge(va::jsonb, vb:...
>                                 ^
> HINT:  No function matches the given name and argument types. You might need
> to add explicit type casts.
> CONTEXT:  SQL function "jsonb_recursive_merge" during inlining
>
> postgreSQL 17.3 also returns the same error.

That's not a bug, that's expected:
https://www.postgresql.org/docs/current/release-17.html#RELEASE-17-MIGRATION

Change functions to use a safe search_path during maintenance operations (Jeff Davis)

So that's actually a bug in your function definition.
Fix it by running

ALTER FUNCTION ... SET search_path = schema_containing_function;

Make sure that the schema does *not* have CREATE privileges for PUBLIC...

Yours,
Laurenz Albe

--

*E-Mail Disclaimer*
Der Inhalt dieser E-Mail ist ausschliesslich fuer den
bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat
dieser E-Mail oder dessen Vertreter sein sollten, so beachten Sie bitte,
dass jede Form der Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder
Weitergabe des Inhalts dieser E-Mail unzulaessig ist. Wir bitten Sie, sich
in diesem Fall mit dem Absender der E-Mail in Verbindung zu setzen.

*CONFIDENTIALITY NOTICE & DISCLAIMER
*This message and any attachment are
confidential and may be privileged or otherwise protected from disclosure
and solely for the use of the person(s) or entity to whom it is intended.
If you have received this message in error and are not the intended
recipient, please notify the sender immediately and delete this message and
any attachment from your system. If you are not the intended recipient, be
advised that any use of this message is prohibited and may be unlawful, and
you must not copy this message or attachment or disclose the contents to
any other person.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Olivier Jolly 2025-02-16 17:33:04 Re: BUG #18813: Materialized view creation regression when inlining recursive SQL function
Previous Message PG Bug reporting form 2025-02-16 15:49:55 BUG #18813: Materialized view creation regression when inlining recursive SQL function