Re: [HACKERS] pg_dump versus rules, once again - Mailing list pgsql-hackers

From Benedikt Grundmann
Subject Re: [HACKERS] pg_dump versus rules, once again
Date
Msg-id CADbMkNO08sgwHLLX-vLRL4vwrOvcMX2UpRXTmiR4zjiRfEHuKQ@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] pg_dump versus rules, once again  (Benedikt Grundmann <bgrundmann@janestreet.com>)
List pgsql-hackers


On 30 December 2016 at 11:58, Benedikt Grundmann <bgrundmann@janestreet.com> wrote:

On 17 November 2016 at 03:45, Robert Haas <robertmhaas@gmail.com> wrote:
On Wed, Nov 16, 2016 at 10:14 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Wed, Nov 16, 2016 at 10:00 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> The changes in pg_backup_archiver.c would have to be back-patched
>>> into all versions supporting --if-exists, so that they don't fail
>>> on dump archives produced by patched versions.
>
>> Even if you patch future minor releases, past minor releases are still
>> going to exist out there in the wild for a long, long time.
>
> Yeah, but it would only matter if you try to use pg_restore --clean --if-exists
> with an archive file that happens to contain a view that has this issue.
> Such cases would previously have failed anyway, because of precisely
> the bug at issue ... and there aren't very many of them, or we'd have
> noticed the problem before.  So I don't feel *too* bad about this,
> I just want to make sure we have a solution available.

Right, OK.

For what it is worth we just run into this problem on our postgres 9.2.17 installation on a hunch we (after reading Tom's initial email replaced the view that caused this by this

create view ... as select * from (...original view definition...) hack_around_pg_dump_versus_rules_bug;

Which caused pg_dump to change its behavior and instead emit create view .... which is what we wanted (because we take filtered down and dependency ordered outputs of pg_dump as the starting point for new patches to the db).  But it surprised me mildly that the hack "worked" so I thought I would mention it here.   It might just mean that I'm misunderstanding the bug but if there was really a dependency in the original that dependency still exists now.


N/m turns out that using pg_dump -t <viewname> isn't a good way to test if the hack works because than it always does the good thing.
 

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


pgsql-hackers by date:

Previous
From: Benedikt Grundmann
Date:
Subject: Re: [HACKERS] pg_dump versus rules, once again
Next
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] proposal: session server side variables