Re: pg_dump search path issue

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Elijah Zupancic <elijah(at)zupancic(dot)name>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: pg_dump search path issue
Date: 2015-03-11 00:49:56
Message-ID: 871tkwtld3.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Elijah Zupancic <elijah(at)zupancic(dot)name> writes:
>> In the SQL dump, you will notice that the SET search_path = xxx
>> values will often not include the public schema which holds the
>> functions needed to properly recreate tables that depend on
>> extensions.

Tom> All the cases I've seen of this involve user-defined functions
Tom> that are broken, often dangerously so.

Just found (via a report on irc) a case that doesn't involve functions:

create extension hstore;
create schema foo
create table t1 (a hstore, b integer)
create table t2 (a hstore, c integer)
create view v1 as select * from t1 join t2 using (a);

dump/restore gives:

ERROR: operator does not exist: public.hstore = public.hstore
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
STATEMENT: CREATE VIEW v1 AS
SELECT t1.a,
t1.b,
t2.c
FROM (t1
JOIN t2 USING (a));

(the reporting user was actually using ip4r's ip4 type, which makes more
sense as a join column than hstore does, but the idea is the same)

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2015-03-11 02:09:10 Re: pg_dump search path issue
Previous Message Heikki Linnakangas 2015-03-10 22:33:43 Re: BUG #12845: The GB18030 encoding doesn't support Unicode characters over 0xFFFF

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-03-11 02:09:10 Re: pg_dump search path issue
Previous Message Josh Kupershmidt 2015-03-10 20:50:50 Re: reltoastidxid altenates in postgresql 9.4