Re: BUG #8257: Multi-Core Restore fails when containing index comments

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: lalbin(at)fhcrc(dot)org
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8257: Multi-Core Restore fails when containing index comments
Date: 2013-06-27 08:01:35
Message-ID: 20130627080135.GA12870@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Lloyd,

On 2013-06-26 23:43:00 +0000, lalbin(at)fhcrc(dot)org wrote:
> I have found the restore will fail when using pg_restore's -j option, with
> more than one core, on a dump that contains a COMMENT INDEX.

> Run this next section to add the table, index, and index comment to the
> test_db database.

> CREATE TABLE public.tbl_test (
> pkey TEXT NOT NULL,
> CONSTRAINT tbl_test_pkey PRIMARY KEY(pkey)
> );

> COMMENT ON INDEX public.tbl_test_pkey
> IS 'Index Comment';

> Once this test database is created, create a backup of the database.
> pg_dump -Fc test_db > test_db.dump

The problem is that pg_dump makes the comment depend on the index
instead of the constraint:

; Selected TOC Entries:
...
170; 1259 69261 TABLE public tbl_test andres
; depends on: 6
1941; 0 69261 TABLE DATA public tbl_test andres
; depends on: 170
1833; 2606 69268 CONSTRAINT public tbl_test_pkey andres
; depends on: 170 170
1950; 0 0 COMMENT public INDEX tbl_test_pkey andres
; depends on: 1832

There is no object 1832 in the dump since that was ommitted in favor of
the constraint 1833 which internally creates the index. So what we need
to do is to make the comment depend on the constraint instead.

With the attached patch we get:

170; 1259 69261 TABLE public tbl_test andres
; depends on: 6
1941; 0 69261 TABLE DATA public tbl_test andres
; depends on: 170
1833; 2606 69268 CONSTRAINT public tbl_test_pkey andres
; depends on: 170 170
1950; 0 0 COMMENT public INDEX tbl_test_pkey andres
; depends on: 1833

unsurprisingly after that restore completes.

Greetings,

Andres Freund

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

Attachment Content-Type Size
fix-pg-dump-order-with-comment-on-index.patch text/x-patch 1.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2013-06-27 08:06:05 Re: BUG #8255: encoding latin1
Previous Message Kristopher Kane 2013-06-27 01:55:46 BUG #8238: duplicate of bug #6372 on panffs