Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ai2z9-0008HA-2V for pgsql-bugs@arkaria.postgresql.org; Mon, 21 Mar 2016 16:47:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ai2z8-0001tN-LT for pgsql-bugs@arkaria.postgresql.org; Mon, 21 Mar 2016 16:47:18 +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_2) (envelope-from ) id 1ai2yV-00015P-IR for pgsql-bugs@postgresql.org; Mon, 21 Mar 2016 16:46:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ai2yO-000620-A2 for pgsql-bugs@postgresql.org; Mon, 21 Mar 2016 16:46:39 +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 u2LGkUQX022853; Mon, 21 Mar 2016 12:46:30 -0400 From: Tom Lane To: rpegues@tripwire.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14038: substring cuts unicode char in half, allowing to save broken utf8 into table In-reply-to: <20160321143927.2903.55302@wrigleys.postgresql.org> References: <20160321143927.2903.55302@wrigleys.postgresql.org> Comments: In-reply-to rpegues@tripwire.com message dated "Mon, 21 Mar 2016 14:39:27 -0000" Date: Mon, 21 Mar 2016 12:46:30 -0400 Message-ID: <22852.1458578790@sss.pgh.pa.us> 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 rpegues@tripwire.com writes: > We have a table with an update trigger where if you modify a certain column, > we change the name of the row by calling a function. > In the function, substring() the name and then add a random string to that. > However, the substring appears to cut a unicode character in half, and the > update trigger then updates the name with the broken string. That should not happen if Postgres knows it's dealing with unicode data. What have you got the database's encoding set to? 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