pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Arnd Hannemann <arnd.hannemann@credativ.de>
To: pgsql-bugs@postgresql.org
Subject: postgresql 9.0.3: parallel restore fails with comments on indices
Date: Fri, 18 Feb 2011 09:48:36 +0100
Message-ID: <4D5E3264.7060705@credativ.de> (raw)

Hi,

postgres version: 9.0.3
OS: debian squeeze 64bit

if pg_restore is used with -jN it fails if the dump has comments on indices.

Steps to reproduce (db testdb):

CREATE DATABASE testdb;
\c testdb
CREATE TABLE tab (id INT);
INSERT INTO tab VALUES (1);
CREATE INDEX idx ON tab USING btree (id);
COMMENT ON INDEX idx IS 'first index';

(pgsql-pg_9.0.3)aha@abt:~/bin$ pg_restore --version
pg_restore (PostgreSQL) 9.0.3
(pgsql-pg_9.0.3)aha@abt:~/bin$ pg_dump -F c testdb > testdb.pg_dump
(pgsql-pg_9.0.3)aha@abt:~/bin$ pg_restore -j2 -c -d testdb testdb.pg_dump
ERROR:  relation "idx" does not exist
STATEMENT:  COMMENT ON INDEX idx IS 'first index';
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1784; 0 0 COMMENT INDEX idx aha
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "idx" does not exist
    Command was: COMMENT ON INDEX idx IS 'first index';
WARNING: errors ignored on restore: 1

(pgsql-pg_9.0.3)aha@abt:~/bin$ pg_restore  -c -d testdb testdb.pg_dump
(pgsql-pg_9.0.3)aha@abt:~/bin$ echo $?
0


The problem seems to be a false assumption in pg_backup_archiver.c:

3200         for (next_work_item = AH->toc->next; next_work_item != AH->toc; next_work_item = next_work_item->next)
3201         {
3202                 /* Non-PRE_DATA items are just ignored for now */
3203                 if (next_work_item->section == SECTION_DATA ||
3204                         next_work_item->section == SECTION_POST_DATA)
3205                         continue;
3206
3207                 ahlog(AH, 1, "processing item %d %s %s\n",
3208                           next_work_item->dumpId,
3209                           next_work_item->desc, next_work_item->tag);
3210
3211                 (void) restore_toc_entry(AH, next_work_item, ropt, false);
3212
3213                 /* there should be no touch of ready_list here, so pass NULL */
3214                 reduce_dependencies(AH, next_work_item, NULL);
3215         }

Comments are in SECTION_NONE so they get restored here regardless of dependencies, which is obviously wrong
because the comment on an INDEX depends on the INDEX itself and the INDEX is in SECTION_POST_DATA


Best regards
Arnd


-- 
Arnd Hannemann

credativ GmbH, HRB Mönchengladbach 12080
Hohenzollernstr. 133, 41061 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz




view thread (2+ messages)  latest in thread

Message-ID: <4D5E3264.7060705@credativ.de>
Permalink:  ../4D5E3264.7060705@credativ.de/
Also on:    postgresql.org/message-id/4D5E3264.7060705@credativ.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: arnd.hannemann@credativ.de
  Subject: Re: postgresql 9.0.3: parallel restore fails with comments on indices
  In-Reply-To: <4D5E3264.7060705@credativ.de>
  References: <4D5E3264.7060705@credativ.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox