(Bug? or Intended?) Inconsistent search_path Behavior in Function Calls via Materialized View in PostgreSQL 17
От | Kanitchet Vaiassava |
---|---|
Тема | (Bug? or Intended?) Inconsistent search_path Behavior in Function Calls via Materialized View in PostgreSQL 17 |
Дата | |
Msg-id | KL1PR0401MB51326DEE3C1BA7DE89488B92D8FB2@KL1PR0401MB5132.apcprd04.prod.outlook.com обсуждение исходный текст |
Ответы |
Re: (Bug? or Intended?) Inconsistent search_path Behavior in Function Calls via Materialized View in PostgreSQL 17
|
Список | pgsql-bugs |
I just upgrade from postgres 14 to 17 and found Inconsistent search_path Behavior in Function Calls via Materialized View in PostgreSQL 17
Summary
According to image attached, when calling a function directly, it respects the configured
search_path
(public
). However, when the same function is invoked through a REFRESH MATERIALIZED VIEW
, the search_path
defaults to pg_catalog, pg_temp
, causing relation lookup failures. (the postgres 14 is consistency while postgres 17 is not)Expected Behavior
- The function should inherit the
search_path
from its session (public
). - The behavior of function execution should be consistent whether called directly or indirectly via a Materialized View.
Actual Behavior (postgres 17)
- Calling the function directly works fine (
search_path = public
). - Calling the function through a Materialized View defaults
search_path
topg_catalog, pg_temp
, causing it to fail to find tables
Environment Details
Configuration: search_path = 'public' in pg 17 && search_path = '"$user," public' in pg14
Possible Causes / Thoughts
- The function execution context in a
REFRESH MATERIALIZED VIEW
may not inheritsearch_path
correctly. - PostgreSQL’s security model in newer versions (15+) might enforce a stricter
search_path
default (pg_catalog, pg_temp
) inside Materialized View refresh execution ???? (which I have not found in web's document)
Regard.
В списке pgsql-bugs по дате отправления: