pg_dump cosmetic problem while dumping/restoring rules

Lists: pgsql-hackers
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
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


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Gražvydas Valeika <gvaleika(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump cosmetic problem while dumping/restoring rules
Date: 2012-12-11 14:47:10
Message-ID: 20121211144710.GC5062@alap2.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2012-12-11 16:34:35 +0200, Gražvydas Valeika wrote:
> 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.

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

I'd say this is actually a real bug in the extensions tracking of
dependencies.
And it would have caused a failed restore if you had used single
transaction mode.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Gražvydas Valeika <gvaleika(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump cosmetic problem while dumping/restoring rules
Date: 2012-12-11 22:43:10
Message-ID: m2fw3cdxc1.fsf@2ndQuadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
>> 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.
>
>> As I understand these errors are harmless, I would say - cosmetic defects.
>
> I'd say this is actually a real bug in the extensions tracking of
> dependencies.
> And it would have caused a failed restore if you had used single
> transaction mode.

Indeed. I will look into that.

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support


From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Gražvydas Valeika <gvaleika(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump cosmetic problem while dumping/restoring rules
Date: 2013-06-19 16:52:23
Message-ID: m27ghqniuw.fsf@2ndQuadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Gražvydas Valeika <gvaleika(at)gmail(dot)com> writes:
> - 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:

This has been fixed by Joe Conway meanwhile.

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support


From: Gražvydas Valeika <gvaleika(at)gmail(dot)com>
To:
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump cosmetic problem while dumping/restoring rules
Date: 2013-06-19 19:22:01
Message-ID: CAO6eJZr0unJ2VkarR8wCZ1SZn+UQ8uOYVupmPqex311+hvL=_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> This has been fixed by Joe Conway meanwhile.
>

Nice,

thaks!