pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: nicolas@cybercat.ca
To: pgsql-bugs@postgresql.org
Subject: BUG #10500: Cannot restore from a dump when some function is used in public shcema
Date: Mon, 02 Jun 2014 16:14:27 +0000
Message-ID: <20140602161427.2797.72238@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      10500
Logged by:          Nicolas Ross
Email address:      nicolas@cybercat.ca
PostgreSQL version: 9.3.4
Operating system:   CentOS 6.5
Description:        

Hi !

I have encountered a problem when restoring a database from a dump made with
pg_dump.

I narrow it down to this simple exemple. Here's a pg_dump in plain text of
my test case :

CREATE SCHEMA intranet;
CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;
SET search_path = public, pg_catalog;
CREATE FUNCTION cyunaccent(character varying) RETURNS character varying
    LANGUAGE sql IMMUTABLE
    AS $_$ SELECT unaccent(lower($1)); $_$;
-- At this stage, the cyunaccent function is created in the public shcema to
later be used by tables in all schema.
SET search_path = intranet, pg_catalog;
CREATE TABLE intranet.client (
    codeclient character varying(10) NOT NULL,
    noclient character varying(7),
    nomclient character varying(200) COLLATE pg_catalog."fr_CA"
);
ALTER TABLE ONLY client
    ADD CONSTRAINT client_pkey PRIMARY KEY (codeclient);

CREATE INDEX idx_clientnomclient ON client USING btree
(public.cyunaccent((lower((nomclient)::text))::character varying));

The pg_restore or psql won't create the index in the last sql, despite the
fact that the public schema is specified to reference the function.

The problem lies in the 

SET search_path = intranet, pg_catalog;

call.

Changing it to 

SET search_path = intranet, public, pg_catalog;

solves the problem.

I don't know if this is a bug in the way that the dump is produced or in the
way that the create index is done, but I beleive there is a bug here.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)  latest in thread

Message-ID: <20140602161427.2797.72238@wrigleys.postgresql.org>
Permalink:  ../20140602161427.2797.72238@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20140602161427.2797.72238@wrigleys.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: nicolas@cybercat.ca
  Subject: Re: BUG #10500: Cannot restore from a dump when some function is used in public shcema
  In-Reply-To: <20140602161427.2797.72238@wrigleys.postgresql.org>
  References: <20140602161427.2797.72238@wrigleys.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