Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 5903C1442C29 for ; Fri, 24 Feb 2012 18:31:18 -0400 (AST) Received: from mail-vw0-f46.google.com ([209.85.212.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S13fY-0002Ql-An for pgsql-admin@postgresql.org; Fri, 24 Feb 2012 22:31:17 +0000 Received: by vbjk17 with SMTP id k17so1846643vbj.19 for ; Fri, 24 Feb 2012 14:31:03 -0800 (PST) Received-SPF: pass (google.com: domain of cmdrclueless@gmail.com designates 10.220.3.10 as permitted sender) client-ip=10.220.3.10; Authentication-Results: mr.google.com; spf=pass (google.com: domain of cmdrclueless@gmail.com designates 10.220.3.10 as permitted sender) smtp.mail=cmdrclueless@gmail.com; dkim=pass header.i=cmdrclueless@gmail.com Received: from mr.google.com ([10.220.3.10]) by 10.220.3.10 with SMTP id 10mr2772414vcl.23.1330122663442 (num_hops = 1); Fri, 24 Feb 2012 14:31:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:subject:date:message-id :to:mime-version:x-mailer; bh=UM37qZr2IzT4A1juN3h5pcdkHn1v7y8iF4EXK8wzrkc=; b=qdQYMFBntLWwOUcPzMGgTlxNwtRiNsp+TkB94NebCK4HYMlgmJnDaWK7dSOsxrCKOI L3XuIS0hCAFKPfe2vHbZJoQfBsEUiwOoPAEeZgYKtyNXV+wrR4OIiWB3Z6U5GE/guv9d c55l3ccY0TxMTg6OkktPFlwOhaKsBicDz/8AE= Received: by 10.220.3.10 with SMTP id 10mr2186446vcl.23.1330122663398; Fri, 24 Feb 2012 14:31:03 -0800 (PST) Received: from samhain.raleigh.raritan.com ([66.93.99.2]) by mx.google.com with ESMTPS id d7sm388584vdu.15.2012.02.24.14.31.01 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 14:31:02 -0800 (PST) From: Brian Weaver Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Problems with pg_restore (plpgsql already exists) Date: Fri, 24 Feb 2012 17:30:58 -0500 Message-Id: To: pgsql-admin@postgresql.org Mime-Version: 1.0 (Apple Message framework v1257) X-Mailer: Apple Mail (2.1257) X-Pg-Spam-Score: -1.7 (-) X-Archive-Number: 201202/100 X-Sequence-Number: 39160 I'm running into a problem where I can't restore a previous database = using pg_restore because the plpgsql language already exists. All the = searching I've done implies that the fix is to created the database from = template0, but that doesn't seem 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 = to try 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=3Dtemplate1' I use the '--dbname=3Dtemplate1' option to allow the process to connect = to the server and create the database for me. It's my understanding from = reading the man page that's the correct way to connect. Since it's a new = database there's no other database to connect to since template0 refuses = connections (or at least it has when I've tried recently). Also, this = is 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 =3D template0 ENCODING =3D 'UTF8' = LC_COLLATE =3D 'en_US.UTF-8' LC_CTYPE =3D 'en_US.UTF-8'; ALTER DATABASE foo OWNER TO foo; \connect foo SET statement_timeout =3D 0; SET client_encoding =3D 'UTF8'; SET standard_conforming_strings =3D off; SET check_function_bodies =3D false; SET client_min_messages =3D warning; SET escape_string_warning =3D off; -- -- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres -- CREATE PROCEDURAL LANGUAGE plpgsql; ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres; SET search_path =3D 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=