Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VdoSV-0003i8-8M for pgsql-bugs@arkaria.postgresql.org; Tue, 05 Nov 2013 21:46:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VdoSU-0004jU-NI for pgsql-bugs@arkaria.postgresql.org; Tue, 05 Nov 2013 21:46:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VdoML-0003kj-1P for pgsql-bugs@postgresql.org; Tue, 05 Nov 2013 21:40:25 +0000 Received: from mail-wi0-f172.google.com ([209.85.212.172]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VdoMG-0007eD-Hp for pgsql-bugs@postgresql.org; Tue, 05 Nov 2013 21:40:24 +0000 Received: by mail-wi0-f172.google.com with SMTP id ez12so2823312wid.5 for ; Tue, 05 Nov 2013 13:40:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=cV2BCKiAfy2CVeOmnmnpDK9IgEOTWnnBcv1jjOVhShI=; b=iWh4S7mXrDrtTJML0XPQ/TeGRYTX3IS5EjYYCOQFVRfn+EQjIvIKxoNvXeIuJUizKw i/JQIbGtYgK3bBoHyWWO+zz1+gvoYkmCq/T1Qwq+Xeq/RiJBM92+Cjw5zlJh4Erw/F5F kYpV7IXA9mPZfqn2hiNXkM/uq6jA+JEdCtXMsbipKGRv/MgS66/6/FKRqwltq+EzBcmD gTxPT+esvOLurbO8a3cSZMTeecWg7ZQ0xKcXsCkCj+MHSaJgLVt0UrtyjciWPV22KkXb YFyCzYQIAFcIdjKPNcKGCRIyOvPKBl19UBfH0zAcxicdXk1SlP4tPTCXWic6FCrb4mHA TDmw== X-Gm-Message-State: ALoCoQlLuFAg51zE93QB/C67NqHuWoMbdshVl6/jZBY5L26vkjq21lwYwwxf0cNi3rW1dY/f6JCw X-Received: by 10.180.84.101 with SMTP id x5mr18331328wiy.58.1383687619281; Tue, 05 Nov 2013 13:40:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.173.138 with HTTP; Tue, 5 Nov 2013 13:39:58 -0800 (PST) X-Originating-IP: [80.108.207.11] In-Reply-To: <20131105211536.GI14819@awork2.anarazel.de> References: <20131105211536.GI14819@awork2.anarazel.de> From: Dominik Dorn Date: Tue, 5 Nov 2013 22:39:58 +0100 Message-ID: Subject: Re: BUG #8577: pg_dump custom format exported dump can't be imported again To: Andres Freund Cc: pgsql-bugs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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 wrote: > On 2013-11-05 20:53:32 +0000, dominik@dominikdorn.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/ -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs