pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #18813: Materialized view creation regression when inlining recursive SQL function
3+ messages / 3 participants
[nested] [flat]
* BUG #18813: Materialized view creation regression when inlining recursive SQL function
@ 2025-02-16 15:49 PG Bug reporting form <noreply@postgresql.org>
2025-02-16 16:24 ` Re: BUG #18813: Materialized view creation regression when inlining recursive SQL function Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 1 reply; 3+ messages in thread
From: PG Bug reporting form @ 2025-02-16 15:49 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: zeograd@gmail.com
The following bug has been logged on the website:
Bug reference: 18813
Logged by: Olivier Jolly
Email address: zeograd@gmail.com
PostgreSQL version: 17.3
Operating system: Debian 12.2 (official docker images)
Description:
Hi,
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.
A somewhat minimal .sql script triggering the error (as well as reproducible
CLI invocations and results from the execution in 16.7, 17.0 and 17.3
official docker images) is available on
https://gitlab.com/-/snippets/4807302
I would expect that postgreSQL 17.x allows creating my materialized view
like it did in postgreSQL 16.7
Thanks in advance for your help,
Olivier
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #18813: Materialized view creation regression when inlining recursive SQL function
2025-02-16 15:49 BUG #18813: Materialized view creation regression when inlining recursive SQL function PG Bug reporting form <noreply@postgresql.org>
@ 2025-02-16 16:24 ` Laurenz Albe <laurenz.albe@cybertec.at>
2025-02-16 17:33 ` Re: BUG #18813: Materialized view creation regression when inlining recursive SQL function Olivier Jolly <zeograd@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Laurenz Albe @ 2025-02-16 16:24 UTC (permalink / raw)
To: zeograd@gmail.com; pgsql-bugs@lists.postgresql.org
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #18813: Materialized view creation regression when inlining recursive SQL function
2025-02-16 15:49 BUG #18813: Materialized view creation regression when inlining recursive SQL function PG Bug reporting form <noreply@postgresql.org>
2025-02-16 16:24 ` Re: BUG #18813: Materialized view creation regression when inlining recursive SQL function Laurenz Albe <laurenz.albe@cybertec.at>
@ 2025-02-16 17:33 ` Olivier Jolly <zeograd@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Olivier Jolly @ 2025-02-16 17:33 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-bugs@lists.postgresql.org
Le 16/02/2025 à 17:24, Laurenz Albe a écrit :
> 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...
>
Many thanks for the fast on point answer.
I had read this part of the release note, but did not think it would
apply to functions defined in PUBLIC (as it was part of the default
search_path)
ALTER FUNCTION ... SET search_path = public;
fixed my script in 17.x, indeed.
Thanks a lot, sorry for not finding out by myself.
Take care,
Olivier
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2025-02-16 17:33 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-16 15:49 BUG #18813: Materialized view creation regression when inlining recursive SQL function PG Bug reporting form <noreply@postgresql.org>
2025-02-16 16:24 ` Laurenz Albe <laurenz.albe@cybertec.at>
2025-02-16 17:33 ` Olivier Jolly <zeograd@gmail.com>
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