pg_dump cosmetic problem while dumping/restoring rules

From: Gražvydas Valeika <gvaleika(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_dump cosmetic problem while dumping/restoring rules
Date: 2012-12-11 14:34:35
Message-ID: CAO6eJZrsxPNsD=LZPrLJ4kUx-4yB2TtpbiU-2bMH8L1gqdHF9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

with 9.2.2 I can see harmless cosmetic defect while dumping/restoring
database with postgis extension.

Steps to reproduce:

- create new database;
- CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
- backup it;
- create new database and restore it from this new backup.

It produces 3 errors while executing these 3 statements:

CREATE RULE geometry_columns_delete AS ON DELETE TO geometry_columns DO
INSTEAD NOTHING;
CREATE RULE geometry_columns_insert AS ON INSERT TO geometry_columns DO
INSTEAD NOTHING;
CREATE RULE geometry_columns_update AS ON UPDATE TO geometry_columns DO
INSTEAD NOTHING;

All 3 errors are similar to this:

pg_restore: [archiver (db)] Error from TOC entry 3874; 2618 396850 RULE
geometry_columns_delete postgres
pg_restore: [archiver (db)] could not execute query: ERROR: rule
"geometry_columns_delete" for relation "geometry_columns" already exists
Command was: CREATE RULE geometry_columns_delete AS ON DELETE TO
geometry_columns DO INSTEAD NOTHING;

This happens because in the beginning of backup file there is issued
command
CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
which creates those rules.

Solution could be not to issue commands to create abovementioned rules, or
issue 'CREATE OR REPLACE RULE' instead of 'CREATE RULE'.

As I understand these errors are harmless, I would say - cosmetic defects.

Best regards,

Grazvydas Valeika

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-12-11 14:44:39 Re: [PATCH 02/14] Add support for a generic wal reading facility dubbed XLogReader
Previous Message Heikki Linnakangas 2012-12-11 13:56:38 Re: [PATCH 02/14] Add support for a generic wal reading facility dubbed XLogReader