Re: Unqualified name not resolved in function called from materialized view (17.4)
Laurenz Albe <laurenz.albe@cybertec.at>
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Peter Wright <pete@flooble.net>, pgsql-bugs@lists.postgresql.org
Date: 2025-03-11T11:58:37Z
Lists: pgsql-bugs
On Tue, 2025-03-11 at 19:45 +1100, Peter Wright wrote: > PostgreSQL version: 17.4 > Operating system: Ubuntu 24.04, x86_64, kernel 6.8.0-51-generic > Description: > > Given a file "break_it.sql" containing this SQL: > > SELECT version(); > CREATE VIEW things AS SELECT 1 AS id, 'rock' AS thing_name; > CREATE FUNCTION num_things() RETURNS INTEGER AS $$ SELECT COUNT(1) FROM things; $$ LANGUAGE SQL STABLE; > CREATE MATERIALIZED VIEW thing_report AS SELECT num_things() AS number_of_things; > > Running the following commands with the environment pointing at a PostgreSQL 17.4 server: > > psql:break_it.sql:4: ERROR: relation "things" does not exist > LINE 1: SELECT COUNT(1) FROM things; > ^ > QUERY: SELECT COUNT(1) FROM things; > CONTEXT: SQL function "num_things" during inlining > > > Running the same commands with the environment pointing at a PostgreSQL 16.8 > server does *not* report an error That is not a bug, it is intentional. See the first entry in the list of incompatibilities https://www.postgresql.org/docs/current/release-17.html#RELEASE-17-MIGRATION You should fix the function. Yours, Laurenz Albe