Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aTY5F-0005d1-1q for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Feb 2016 16:57:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aTY5E-0004RY-DA for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Feb 2016 16:57:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aTY5D-0004RR-Vf for pgsql-bugs@postgresql.org; Wed, 10 Feb 2016 16:57:40 +0000 Received: from out.smtp-auth.no-ip.com ([8.23.224.60]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aTY59-0005xf-Rc for pgsql-bugs@postgresql.org; Wed, 10 Feb 2016 16:57:39 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [181.43.2.6]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 1E682400D63; Wed, 10 Feb 2016 08:57:27 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 20D7A580; Wed, 10 Feb 2016 17:52:22 +0100 (CET) Date: Wed, 10 Feb 2016 13:52:22 -0300 From: Alvaro Herrera To: bear2k@mail.ru Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13935: Duplicate row in pg_constraint table which is not accessible via indexes Message-ID: <20160210165222.GA347443@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160208163222.2661.51608@wrigleys.postgresql.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.1 (-) 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 bear2k@mail.ru wrote: > First, select rows with segment scan: > > # select oid,ctid,xmin,xmax,conrelid,contype from pg_constraint where > conrelid::int + 0 = 50621; > oid | ctid | xmin | xmax | conrelid | contype > --------+---------+---------+------+----------+--------- > 301952 | (6,136) | 4883898 | 0 | 50621 | p > 300466 | (7,1) | 4786734 | 0 | 50621 | p > (2 rows) We've had reports of duplicate rows appearing in user tables, where only one copy is visible through indexes, but most updates of pg_constraint don't go through the normal executor, but rather direct catalog manipulation of DDL implementation, so I'd be surprising if it's the same thing. Also, the OIDs of the two rows are different, so really the two physical rows are not update copies of the same logical row. I wonder if you got into this state by adding primary keys concurrently somehow. That should of course not be allowed, but of course there is no UNIQUE constraint on conrelid itself, so the normal unique-ification code in btree does not fire for this situation. Perhaps we have a bug in some ALTER TABLE command. Can you tell us how you created the PK in the affected table? -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs