Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyj8p-0002bk-8A for pgsql-bugs@arkaria.postgresql.org; Sat, 08 Sep 2018 19:43:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fyj8n-0001XT-JI for pgsql-bugs@arkaria.postgresql.org; Sat, 08 Sep 2018 19:43:33 +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.89) (envelope-from ) id 1fyj8n-0001XM-4t for pgsql-bugs@lists.postgresql.org; Sat, 08 Sep 2018 19:43:33 +0000 Received: from mail.webkr.de ([78.47.173.34]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyj8j-0000T0-EP for pgsql-bugs@lists.postgresql.org; Sat, 08 Sep 2018 19:43:31 +0000 ARC-Authentication-Results: i=1; rspamd; auth=pass smtp.auth=andre@webkr.de smtp.mailfrom=andre@webkr.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=webkr.de; s=dkim; t=1536435805; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8BW1jneboRcwo4nAJPyQOcESjhBjH5KVUtalfaMQpoY=; b=NldfNGv8jaZX6mmHY3NQUe0oXE6rW9hA+0yDAH2qYX9a7UN38frBZfGbvXQ9FsAWNz4zbA Y0FQQcDAlz5it4CZoEE39M+WfYd5Fb08nPhpvlX2GOMtAuKUSvbRa6LgL3lud8s5GSzdA5 CL+DnHNCBAbbOjD6+V2DOSP97SBmeWk= ARC-Seal: i=1; s=dkim; d=webkr.de; t=1536435805; a=rsa-sha256; cv=none; b=GwYalpXKsCeVYY4ILE8P1xJC98CLqwscm4oFpM5hkKsD1txXwtGV+ZKNbmRiFWbQ32iIV6bQCByidKHzHdcZaCqjxuhN5RKTZ65gZhdjrdfl2SujULxmKEIs5wYrU6Ep75vDAxsStX0AEwR0gqiOWUCraMbqWVpLhUvlFglos7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=webkr.de; s=dkim; t=1536435805; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8BW1jneboRcwo4nAJPyQOcESjhBjH5KVUtalfaMQpoY=; b=OtueNkU+kv4db8tsssixILxoYI1zmwch4QbpCS2EAxmhgHD0hvIvW7IPSSzo4yVWbhLzA/ CqQAg3tCabwehbO1z/YC1chEVt8KjbWAdlVHWLlUiSMQB1cFCSM7bSZ41OFaiopix8IBof mOSNH+iake8R77omXyr2XO1KhHlUnJw= Received: from LappyAndre (unknown [49.48.42.225]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: andre@webkr.de) by mail.webkr.de (Postfix) with ESMTPSA id A3F8A1A0D89; Sat, 8 Sep 2018 21:43:24 +0200 (CEST) From: =?UTF-8?Q?Andr=C3=A9_H=C3=A4nsel?= To: "'Bruce Momjian'" , , References: <153642745785.23144.1699125571356845227@wrigleys.postgresql.org> <20180908173648.GJ28811@momjian.us> In-Reply-To: <20180908173648.GJ28811@momjian.us> Subject: AW: BUG #15373: null / utf-8 Date: Sat, 8 Sep 2018 21:43:18 +0200 Message-ID: <12e601d447ac$345994a0$9d0cbde0$@webkr.de> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQKVZYTT+rPULkyux9C3qlGaQLmPOAIVdnO4o1PhjjA= Content-Language: de List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Bruce Momjian wrote: =20 > On Sat, Sep 8, 2018 at 05:24:17PM +0000, PG Bug reporting form wrote: >> doesn=E2=80=99t support converting NULL bytes to UTF-8 and therefore = returns an >> error > You need to encode binary values containing nulls as bytea strings. Actually this reminds me to log a documentation bug, or rather = improvement. It is already slightly confusing that Postgres doesn't support null = bytes in text columns at all and in bytea columns cannot take them in as a = normal string literal. I'm assuming this is traditional and difficult to = change. Now, there are two formats in which bytea column content can be = specified, the "hex" and the deprecated "escape" format.=20 This "escape" format is called that way because it allows escape = sequences which are un-escaped before the data is written to the column. This step = is comparable to the parsing of JSON for jsonb columns or the parsing of = array syntax for any array type. However, during the parsing of an SQL there is a second, completely different, un-escaping step going on, the un-escaping of C-style escapes = in string literals starting with an "E", *if* you start the string literal with an "E". For some reason the example given in the documentation for the "hex" format uses such an "escape string literal": SELECT E'\\xDEADBEEF'; I found this very confusing. Can this example be changed to a normal string literal, like this? SELECT '\xDEADBEEF'; Regards, Andre