Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ah2aO-0003fT-HT for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Mar 2016 22:09:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ah2aO-00076J-4S for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Mar 2016 22:09:36 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ah2Zk-0006Cn-Mj for pgsql-bugs@postgresql.org; Fri, 18 Mar 2016 22:08:56 +0000 Received: from fr1.2ndquadrant.fr ([94.23.17.124]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ah2Zh-00049I-NN for pgsql-bugs@postgresql.org; Fri, 18 Mar 2016 22:08:55 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by fr1.2ndquadrant.fr (Postfix) with ESMTP id BF4E960416; Fri, 18 Mar 2016 23:08:49 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at fr1.2ndquadrant.fr Received: from fr1.2ndquadrant.fr ([127.0.0.1]) by localhost (fr1.2ndquadrant.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gYGsF33Gmxxo; Fri, 18 Mar 2016 23:08:48 +0100 (CET) Received: from [192.168.8.107] (87-93-105-158.bb.dnainternet.fi [87.93.105.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: charles) by fr1.2ndquadrant.fr (Postfix) with ESMTPSA id 6C7306040F; Fri, 18 Mar 2016 23:08:48 +0100 (CET) Subject: Re: BUG #14027: n_tup_ins increments regardless of insertion success To: matvejchikov@gmail.com, pgsql-bugs@postgresql.org References: <20160316215910.5232.53548@wrigleys.postgresql.org> From: Vik Fearing Message-ID: <56EC7C6E.6040303@2ndquadrant.fr> Date: Sat, 19 Mar 2016 00:08:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160316215910.5232.53548@wrigleys.postgresql.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) 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 On 03/16/2016 11:59 PM, matvejchikov@gmail.com wrote: > The following bug has been logged on the website: > > Bug reference: 14027 > Logged by: Ilya Matveychikov > Email address: matvejchikov@gmail.com > PostgreSQL version: 9.5.1 > Operating system: Linux > Description: > > postgres=# create table t (name text unique); > postgres=# select n_tup_ins from pg_stat_user_tables where relname='t'; > n_tup_ins > ----------- > 0 > postgres=# insert into t (name) values ('a'); > INSERT 0 1 > postgres=# select n_tup_ins from pg_stat_user_tables where relname='t'; > n_tup_ins > ----------- > 1 > postgres=# insert into t (name) values ('b'); > INSERT 0 1 > postgres=# select n_tup_ins from pg_stat_user_tables where relname='t'; > n_tup_ins > ----------- > 2 > postgres=# insert into t (name) values ('a'); > ОШИБКА: повторяющееся значение ключа нарушает ограничение уникальности > "t_name_key" > ПОДРОБНОСТИ: Ключ "(name)=(a)" уже существует. > postgres=# select n_tup_ins from pg_stat_user_tables where relname='t'; > n_tup_ins > ----------- > 3 This is not a bug, there are three rows inserted into the table, you just can't see the third. Try this: create extension pageinspect; select * from heap_page_items(get_raw_page('t', 0)); and you will see the three rows. -- Vik Fearing +33 6 46 75 15 36 http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs