Problems with pg_restore (plpgsql already exists)

Поиск
Список
Период
Сортировка
От Brian Weaver
Тема Problems with pg_restore (plpgsql already exists)
Дата
Msg-id EB254343-461B-4B6B-93A1-3065BA902CF3@gmail.com
обсуждение исходный текст
Ответы Re: Problems with pg_restore (plpgsql already exists)  (Dinesh Bhandary <dbhandary@iii.com>)
Список pgsql-admin
I'm running into a problem where I can't restore a previous database using pg_restore because the plpgsql language
alreadyexists. All the searching I've done implies that the fix is to created the database from template0, but that
doesn'tseem to be working in my case for some reason. I'm running 9.1.2 and here's the basic procedure that I'm using
totry to restore if anyone has any ideas why it's not working. 

1) Create a new data directory
2) Run initdb to initialize the database directories
3) Run 'pg_restore --create postgresql.pgr --dbname=template1'

I use the '--dbname=template1' option to allow the process to connect to the server and create the database for me.
It'smy understanding from reading the man page that's the correct way to connect. Since it's a new database there's no
otherdatabase to connect to since template0 refuses connections (or at least it has when I've tried recently).  Also,
thisis a new problem I didn't run into when I was using PostgreSQL 8.4 and it's only happened since I've upgraded to
9.1.2.

If I just run 'pg_restore --create postgresql.pgr' I see the following relevant lines:

CREATE DATABASE foo WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';


ALTER DATABASE foo OWNER TO foo;

\connect foo

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;


------ END SNIPPET

As you can see the database is cloned from template0 so I don't know why plpgsql would already exists.

-- Brian

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Igor Neyman"
Дата:
Сообщение: Re: logfile per DataBase
Следующее
От: Dinesh Bhandary
Дата:
Сообщение: Re: Problems with pg_restore (plpgsql already exists)