Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 0E95D185C94E for ; Sat, 14 Jul 2012 14:45:12 -0300 (ADT) Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sq6Ox-0007vE-4H for pgsql-bugs@postgresql.org; Sat, 14 Jul 2012 17:45:11 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sq6Oj-0003wI-B3 for pgsql-bugs@postgresql.org; Sat, 14 Jul 2012 17:44:54 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1Sq6Oi-0004VW-Oj for pgsql-bugs@postgresql.org; Sat, 14 Jul 2012 17:44:52 +0000 Date: Sat, 14 Jul 2012 17:44:52 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6738: pg_dump does not handle extensions properly/invalid pg_dump output To: pgsql-bugs@postgresql.org From: dsavolainen@visi.com X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/112 X-Sequence-Number: 33588 The following bug has been logged on the website: Bug reference: 6738 Logged by: Dave Savolainen Email address: dsavolainen@visi.com PostgreSQL version: 9.1.4 Operating system: Windows XP\server 2003 Description: = Hello, Here is a feature that pg_dump needs: An option needs to be added to explicitly suppress or allow backing up all or selected extensions. Reason and associated bug: The current behavior may by fine with extensions that do not add or change tables, schemas, functions, etc when installed, however some extensions such as postgis does. Restoring to a spatially enabled database will cause errors when the postgis provided rules and schema "topology" is encountered and probably the postgis provided public.spatial_ref_sys table (see ancilliary bug #3). Restoring to a non-spatially enabled database does work since pg_restore does install the postgis extension and spatially enable the database. However pg_restore still throws errors over already existing rules created by postgis as earlier initiated by pg_restore. Ancilliary bug#1 : pg_dump dumps the postgis table data public.spatial_ref_sys. This cannot be suppressed with the --schema-only flag. This may be a problem if the restored database has an upgraded postgis and the public.spatial_ref_sys table has been updated in some way. The newer table may be overwritten with old data. Ancilliary bug#2: I was unable to test the above since pg_restore made no apparant attempt to restore public.spatial_ref_sys, at least there was no mention at all listed in the pg_restore output of any attempt to restore that table even though that table had been dumped in violation of the --schema-only flag. The backup was in tar format created as follows: pg_dump.exe --host localhost --port 5432 --username "postgres" --format tar --verbose --schema-only --file "C:\other\postgres-bak\transfer\data.backup" oec Ancilliary bug#3: pg_restore was unable to restore an otherwise identical = plain text version of the backup file generated by: pg_dump.exe --host localhost --port 5432 --username "postgres" --format plain --verbose --schema-only --file "C:\other\postgres-bak\transfer\data.backup" oec pg_restore output is: pg_restore: [archiver] input file does not appear to be a valid archive If this particular set of options normally does create an invalid backup file, the manual is not clear about it. System specs are as follows: Source database cluster hosted on Windows server 2003 accessed via ssh tunnel Database version: 9.1.4 Postgis version 2.0.0 Backup files restored to database cluster hosted on Windows XP Database version 9.1.4 Postgis version 2.0.1 pg_dump and pg_restore are run on the Windows XP machine and belong to the database installed on that machine.