From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: benoitfontaine.ba@gmail.com
Subject: BUG #17715: dumps file raise an error on restore if a materialized view use a function calling another function
Date: Mon, 12 Dec 2022 15:42:46 +0000
Message-ID: <17715-5b3b05201e49c6a0@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17715
Logged by: BenoƮt Fontaine
Email address: benoitfontaine.ba@gmail.com
PostgreSQL version: 14.5
Operating system: debian
Description:
## Steps to reproduce :
1- Execute this code on an empty database :
```sql
CREATE FUNCTION square (p integer) RETURNS integer AS $$
BEGIN
RETURN p * p;
END;
$$ LANGUAGE plpgsql;
CREATE FUNCTION myfunc (p integer) RETURNS integer AS $$
BEGIN
RETURN square(p) + 1;
END;
$$ LANGUAGE plpgsql;
CREATE TABLE dewey (num integer);
INSERT INTO dewey VALUES (10);
CREATE MATERIALIZED VIEW myview AS (SELECT myfunc (num) FROM dewey);
```
2- Dump this database
3- Restore the dump into another empty database
## Issue
```
psql:res.sql:89: ERROR: function square(integer) does not exist
LINE 1: square (p) + 1
^
HINT: No function matches the given name and argument types. You might need
to add explicit type casts.
QUERY: square (p) + 1
CONTEXT: PL/pgSQL function public.myfunc(integer) line 3 at RETURN
```
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, benoitfontaine.ba@gmail.com
Subject: Re: BUG #17715: dumps file raise an error on restore if a materialized view use a function calling another function
In-Reply-To: <17715-5b3b05201e49c6a0@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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