Re: BUG #8577: pg_dump custom format exported dump can't be imported again

From: Dominik Dorn <dominik(at)dominikdorn(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8577: pg_dump custom format exported dump can't be imported again
Date: 2013-11-05 21:39:58
Message-ID: CABHM76UE8dF9BJSqdBbDNpTS9YgpMt1PW+vL_XOL+aGFwMk59Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Andres,

oh, it returns a row!

lyriks=> SET enable_indexscan = false;
SET
lyriks=> SET enable_bitmapscan = false;
SET
lyriks=> SET constraint_exclusion = false;
SET
lyriks=> EXPLAIN SELECT ctid, * FROM lytartist WHERE nartistnr IS NULL;
QUERY PLAN
-------------------------------------------------------------
Seq Scan on lytartist (cost=0.00..1274.20 rows=1 width=68)
Filter: (nartistnr IS NULL)
(2 rows)

lyriks=> SELECT ctid, * FROM lytartist WHERE nartistnr IS NULL;
ctid | nartistnr | sartist | nartistnralias | nstatusnr | ntypenr
| surl | nlabelnr | nusernr | dnow | ssoundex | surlname
----------+-----------+---------+----------------+-----------+---------+------+----------+---------+------+----------+----------
(284,60) | | | | |
| | | | | |
(1 row)

How do I delete it from there there?
lyriks=> DELETE FROM lytartist where ctid = (284,60);
ERROR: operator does not exist: tid = record
LINE 1: DELETE FROM lytartist where ctid = (284,60);
^
HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.

And how can I prevent inserts like these in the future?

Thanks!

Dominik

On Tue, Nov 5, 2013 at 10:15 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> On 2013-11-05 20:53:32 +0000, dominik(at)dominikdorn(dot)com wrote:
>> For some reason, pg_dump inserts an entry with null values into the dump
>> (even for the primary key).
>
>> 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
>
> Hm. That might be caused by on-disk corruption...
>
>> Of course, querying for the entry with a NULL PK results in no results on
>> the source machine.
>
> Well, that will probably have used the the index, try it by doing
> something like:
> SET enable_indexscan = false;
> SET enable_bitmapscan = false;
> SET constraint_exclusion = false;
> EXPLAIN SELECT ctid, * FROM lytartist WHERE nartistnr IS NULL;
> SELECT ctid, * FROM lytartist WHERE nartistnr IS NULL;
>
> The explain should show a sequential scan, right? Does it now return a row?
>
> Greetings,
>
> Andres Freund

--
Dominik Dorn
http://dominikdorn.com | http://twitter.com/domdorn
XING: https://www.xing.com/profile/Dominik_Dorn
LINKEDIN: http://at.linkedin.com/pub/dominik-dorn/66/b42/bb1/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message John R Pierce 2013-11-05 21:51:20 Re: BUG #8577: pg_dump custom format exported dump can't be imported again
Previous Message Andres Freund 2013-11-05 21:15:36 Re: BUG #8577: pg_dump custom format exported dump can't be imported again