BUG #8577: pg_dump custom format exported dump can't be imported again - Mailing list pgsql-bugs

From dominik@dominikdorn.com
Subject BUG #8577: pg_dump custom format exported dump can't be imported again
Date
Msg-id E1Vdncy-0002HS-7a@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #8577: pg_dump custom format exported dump can't be imported again  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      8577
Logged by:          Dominik Dorn
Email address:      dominik@dominikdorn.com
PostgreSQL version: 9.1.10
Operating system:   Ubuntu x64
Description:

Hi,


I ran into an issue trying to restore a custom dump from postgresql 9.1.10
from one machine into postgresql 9.1.10 on my CI machine.


For some reason, pg_dump inserts an entry with null values into the dump
(even for the primary key).


The commands I used are:


pg_dump -Fc -f dump.sql mydatabase (on the source machine)


pg_restore -e -d mydatabase_2013_11_05 dump.sql


The error I get is:
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3370; 0 61665 TABLE DATA
lytartist lyriks
pg_restore: [archiver (db)] COPY failed for table "lytartist": ERROR:  null
value in column "nartistnr" violates not-null constraint
CONTEXT:  COPY lytartist, line 21841: "\N    \N    \N    \N    \N    \N    \N    \N    \N    \N    \N"
pg_restore: [archiver] worker process failed: exit code 1


the table in question looks like this:


lyriks=> \d lyriks.lytartist
                                           Table "lyriks.lytartist"
     Column     |            Type             |
Modifiers
----------------+-----------------------------+---------------------------------------------------------------
 nartistnr      | integer                     | not null default
nextval('lytartist_nartistnr_seq'::regclass)
 sartist        | character varying(250)      | not null default
''::character varying
 nartistnralias | integer                     |
 nstatusnr      | integer                     | not null default 1660
 ntypenr        | integer                     | not null default 510
 surl           | character varying(250)      | not null default
''::character varying
 nlabelnr       | integer                     |
 nusernr        | integer                     | not null default 0
 dnow           | timestamp without time zone | not null
 ssoundex       | character varying(250)      |
 surlname       | character varying(100)      |


Of course, querying for the entry with a NULL PK results in no results on
the source machine.


Please help!


Thanks,
Dominik

pgsql-bugs by date:

Previous
From: Maxy
Date:
Subject: Re: psql security fail?
Next
From: Andres Freund
Date:
Subject: Re: BUG #8577: pg_dump custom format exported dump can't be imported again