BUG #12465: Materialized view dump restoration issue - Mailing list pgsql-bugs

From jeff.casavant@gmail.com
Subject BUG #12465: Materialized view dump restoration issue
Date
Msg-id 20150108212429.11502.18220@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #12465: Materialized view dump restoration issue  (Tom Lane <tgl@sss.pgh.pa.us>)
PQLIB: Prepared statement speed oddity  (Mark Simonetti <marks@opalsoftware.co.uk>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      12465
Logged by:          Jeff Casavant
Email address:      jeff.casavant@gmail.com
PostgreSQL version: 9.4.0
Operating system:   Ubuntu 14.04.1
Description:

If
 - two functions A and B exist in the public schema
 - A calls B, and
 - a materialized view calls A

then the dump produced by pg_dump or pg_dumpall will throw the following
error when passed to psql -f:

psql:dump.sql:7730: ERROR:  function b() does not exist
LINE 1:  SELECT B()
                ^
HINT:  No function matches the given name and argument types. You might need
to add explicit type casts.
QUERY:   SELECT B()
CONTEXT:  SQL function "b" during inlining

Code to reproduce:

create function b() returns int as $$ select 1 $$ language sql;
create function a() returns int as $$ select b() $$ language sql;
create schema qwr;
create materialized view qwr.c as select a();

Then run pg_dump | psql .

Workaround:

Add public to all calls to 'SET search_path' in the dump.

pgsql-bugs by date:

Previous
From: Noah Misch
Date:
Subject: Re: Re: BUG #11617: issue with dump/restore involving view with hstore data type embedded in where condition
Next
From: Marco Colombo
Date:
Subject: Re: BUG #12088: pg_upgrade 9.3 -> 9.4rc1 - implicit cast not ported