pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17715: dumps file raise an error on restore if a materialized view use a function calling another function
2+ messages / 2 participants
[nested] [flat]

* BUG #17715: dumps file raise an error on restore if a materialized view use a function calling another function
@ 2022-12-12 15:42  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2022-12-12 15:42 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: benoitfontaine.ba@gmail.com

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
```



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #17715: dumps file raise an error on restore if a materialized view use a function calling another function
@ 2022-12-12 16:38  David G. Johnston <david.g.johnston@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2022-12-12 16:38 UTC (permalink / raw)
  To: benoitfontaine.ba@gmail.com, PostgreSQL Bug List <pgsql-bugs@lists.postgresql.org>

On Mon, Dec 12, 2022, 09:28 PG Bug reporting form <noreply@postgresql.org>
wrote:

> 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:
>
> CREATE FUNCTION myfunc (p integer) RETURNS integer AS $$
> BEGIN
>     RETURN square(p) + 1;
> END;
> $$ LANGUAGE plpgsql;
>

Schema qualify the function call so it can work regardless of the
search_path setting.

David J.




>

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-12-12 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 15:42 BUG #17715: dumps file raise an error on restore if a materialized view use a function calling another function PG Bug reporting form <noreply@postgresql.org>
2022-12-12 16:38 ` David G. Johnston <david.g.johnston@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