Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZTjxn-0002tX-JT for pgsql-bugs@arkaria.postgresql.org; Mon, 24 Aug 2015 05:06:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZTjxl-0007u4-Pp for pgsql-bugs@arkaria.postgresql.org; Mon, 24 Aug 2015 05:06:29 +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 1ZTDUY-0001y5-T5 for pgsql-bugs@postgresql.org; Sat, 22 Aug 2015 18:26:10 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZTDUS-0005Af-4A for pgsql-bugs@postgresql.org; Sat, 22 Aug 2015 18:26:10 +0000 MIME-Version: 1.0 Subject: BUG #13584: Upsert. The sequence value is increased. To: pgsql-bugs@postgresql.org From: av.kostromin@gmail.com Date: Sat, 22 Aug 2015 18:25:10 +0000 Message-ID: <20150822182510.12014.27817@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.3 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 The following bug has been logged on the website: Bug reference: 13584 Logged by: jedi Email address: av.kostromin@gmail.com PostgreSQL version: 9.5alpha2 Operating system: Windows 7 Description: Hello, I have the following bug. I have created the following sequence: CREATE SEQUENCE public.t_tags_ident_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 41 CACHE 1; ALTER TABLE public.t_tags_ident_id_seq OWNER TO postgres; and table: CREATE TABLE public.t_tags_ident ( id smallint NOT NULL DEFAULT nextval('t_tags_ident_id_seq'::regclass), tag_name character varying(100) NOT NULL, comment text, reserve character varying(250) DEFAULT NULL::character varying, CONSTRAINT t_tags_ident_pk PRIMARY KEY (tag_name) ) WITH ( OIDS=FALSE ); ALTER TABLE public.t_tags_ident OWNER TO postgres; When I execute the query INSERT INTO t_tags_ident (tag_name, "comment") VALUES ('tag1','comment1'), ('tag2','comment2'), ('tag3','comment3'), ('tag4','comment4') ON CONFLICT (tag_name) DO UPDATE SET "comment" = EXCLUDED.comment RETURNING id there is the following problem. The sequence value is increased by the quantity of updated (conflict) rows, i.e. when I insert the new row its id is equal to the quantity of updated rows + 1. Is it OK for upsert? -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs