Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id ECBF04A2A39 for ; Sat, 25 Feb 2012 14:10:26 -0400 (AST) Received: from sd-17937.dedibox.fr ([88.191.100.74]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S1M4e-00058d-Ge for pgsql-admin@postgresql.org; Sat, 25 Feb 2012 18:10:26 +0000 Received: from [192.168.10.3] (AMontsouris-552-1-157-241.w86-212.abo.wanadoo.fr [86.212.80.241]) by sd-17937.dedibox.fr (Postfix) with ESMTPA id E89553B92D; Sat, 25 Feb 2012 19:10:09 +0100 (CET) Message-ID: <1330193409.2593.5.camel@localhost.localdomain> Subject: Re: Problems with pg_restore (plpgsql already exists) From: Guillaume Lelarge To: Scott Ribe Cc: Brian Weaver , "pgsql-admin@postgresql.org" Date: Sat, 25 Feb 2012 19:10:09 +0100 In-Reply-To: <274BAD81-38BF-4537-B474-ADCDF77E318A@elevated-dev.com> References: <4F4820C8.2000703@iii.com> <1330183903.2593.1.camel@localhost.localdomain> <17919563-C079-438C-9702-5A0806127DFD@gmail.com> <274BAD81-38BF-4537-B474-ADCDF77E318A@elevated-dev.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3 (3.2.3-1.fc16) Content-Transfer-Encoding: 7bit Mime-Version: 1.0 X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201202/106 X-Sequence-Number: 39166 On Sat, 2012-02-25 at 09:23 -0700, Scott Ribe wrote: > On Feb 25, 2012, at 9:18 AM, Brian Weaver wrote: > > > Thanks for the pointer. Is it just me that finds it the behavior of pg_restore odd? If the default installation since 9.0 has PL/PgSQL installed then why does pg_restore still emit statements to create the language? As a developer by trade it smells like a bug. > > It's pg_dump that's emitting the command to create the language. If you ran pg_dump from 9.0+, it would not do so. Not quite true. pg_dump from 9.0 does save the language definition, but it uses the new CREATE OR REPLACE statement for languages, so that, when you restore it in a 9.0+ database that already has the same language, it won't complain with an error message. BTW, it isn't odd that pg_dump 9.0 save the language definition. Having by default the plpgsql language when you create a database doesn't mean you can't drop it. > This is an example of why the standard advice for upgrading is to use the newer pg_dump against the older database Exactly. -- Guillaume http://blog.guillaume.lelarge.info http://www.dalibo.com