Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUbVT-0008SQ-J2 for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Jul 2017 16:25:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dUbVS-0004Xz-Sf for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Jul 2017 16:25:54 +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 1dUbUl-0003E3-35 for pgsql-bugs@postgresql.org; Mon, 10 Jul 2017 16:25:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dUbUe-0001O9-Bp for pgsql-bugs@postgresql.org; Mon, 10 Jul 2017 16:25:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v6AGP1jP002055; Mon, 10 Jul 2017 12:25:01 -0400 From: Tom Lane To: fbd@datasapiens.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14739: Wrong message when unique contraint fail In-reply-to: <20170710131648.7729.77377@wrigleys.postgresql.org> References: <20170710131648.7729.77377@wrigleys.postgresql.org> Comments: In-reply-to fbd@datasapiens.com message dated "Mon, 10 Jul 2017 13:16:48 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2053.1499703901.1@sss.pgh.pa.us> Date: Mon, 10 Jul 2017 12:25:01 -0400 Message-ID: <2054.1499703901@sss.pgh.pa.us> 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 fbd@datasapiens.com writes: > I am testing PG on this query : > CREATE TABLE T_UNIK (ID INT UNIQUE); > INSERT INTO T_UNIK VALUES (1), (2), (3), (4), (5); > UPDATE T_UNIK SET ID = ID + 1; > I know that PG is unable to do this set based operation properly because it > does it row by row (which is a nonsense since it works on many RDBMS) The solution for that is documented: declare the unique constraint as deferrable. regression=# CREATE TABLE T_UNIK (ID INT UNIQUE deferrable ); CREATE TABLE regression=# INSERT INTO T_UNIK VALUES (1), (2), (3), (4), (5); INSERT 0 5 regression=# UPDATE T_UNIK SET ID = ID + 1; UPDATE 5 > But the error message is strongly stupid : > ERROR: invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75 I don't get that here. It looks like you must be typing some non-ASCII characters and not everything is on the same page about what encoding they are in. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs