Re: [HACKERS] Re: 9.2beta1 regression: pg_restore --data-only does not set sequence values any more

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Martin Pitt <mpitt(at)debian(dot)org>, PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Re: 9.2beta1 regression: pg_restore --data-only does not set sequence values any more
Date: 2012-05-25 18:21:59
Message-ID: 4FBFCDC7.8070209@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 05/21/2012 02:59 PM, Andrew Dunstan wrote:
>
>
> On 05/16/2012 10:23 AM, Andrew Dunstan wrote:
>>
>>
>> On Wed, May 16, 2012 at 9:08 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
>> <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> wrote:
>>
>> Martin Pitt <mpitt(at)debian(dot)org <mailto:mpitt(at)debian(dot)org>> writes:
>> > while packaging 9.2 beta 1 for Debian/Ubuntu the postgresql-common
>> > test suite noticed a regression: It seems that pg_restore
>> --data-only
>> > now skips the current value of sequences, so that in the upgraded
>> > database the sequence counter is back to the default.
>>
>> I believe this is a consequence of commit
>> a4cd6abcc901c1a8009c62a27f78696717bb8fe1, which introduced the
>> entirely
>> false assumption that --schema-only and --data-only have
>> something to
>> do with the order that entries appear in the archive ...
>>
>>
>>
>> Darn, will investigate.
>>
>>
>
> [cc -hackers]
>
> Well, the trouble is that we have these pesky SECTION_NONE entries for
> things like comments, security labels and ACLs that need to be dumped
> in the right section, so we can't totally ignore the order. But we
> could (and probably should) ignore the order for making decisions
> about everything BUT those entries.
>
> So, here's a revised plan:
>
> --section=data will dump exactly TABLE DATA, SEQUENCE SET or BLOBS
> entries
> --section=pre-data will dump SECTION_PRE_DATA items (other than
> SEQUENCE SET) plus any immediately following SECTION_NONE items.
> --section=post-data will dump everything else.
>
>

It turns out there were some infelicities with pg_dump as well as with
pg_restore.

I think the attached patch does the right thing. I'll keep testing -
I'll be happier if other people bang on it too.

cheers

andrew

Attachment Content-Type Size
sectionfix.patch text/x-patch 3.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message rammses.prateat 2012-05-25 19:16:44 BUG #6665: problema com Grant
Previous Message Tom Lane 2012-05-25 14:51:20 Re: 9.1.3 backends getting stuck in 'startup'

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-05-25 19:10:12 Re: Archiver not exiting upon crash
Previous Message Merlin Moncure 2012-05-25 18:15:02 Re: 9.2beta1, parallel queries, ReleasePredicateLocks, CheckForSerializableConflictIn in the oprofile