Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o5iUh-0000dV-Sc for pgsql-general@arkaria.postgresql.org; Mon, 27 Jun 2022 06:45:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o5iUg-0007Nw-RG for pgsql-general@arkaria.postgresql.org; Mon, 27 Jun 2022 06:45:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o5iUg-0007Nl-Ev for pgsql-general@lists.postgresql.org; Mon, 27 Jun 2022 06:45:10 +0000 Received: from mout3.freenet.de ([2001:748:100:40::2:5]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o5iUe-0004vG-BS for pgsql-general@lists.postgresql.org; Mon, 27 Jun 2022 06:45:09 +0000 Received: from [195.4.92.121] (helo=sub2.freenet.de) by mout3.freenet.de with esmtpa (ID rissler.wolfgang@freenet.de) (port 25) (Exim 4.94.2 #2) id 1o5iUb-001Xzq-9W; Mon, 27 Jun 2022 08:45:05 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freenet.de; s=mjaymdexmjqk; h=Content-Transfer-Encoding:Content-Type:Subject:From:Cc:To: MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=mHvq1FD1Zz/wkoGFRx663pbQbNUhCiYBKDFyyiWxQSg=; b=B4EXOrV/vtCIjE/slPruuc3Dh0 RlEGPLAwEqgHHjGNR2HiQ4Ok2IFBIbthjh1DmXk8WDm7GH5wxQp6g4e6IzI0xoqAIwuvEYktUT3JR hdQispMKQ3o4t/XqMWe1gzKYMQOkRGcoJvOyHYWTfHDJkFTxuoUB9L8uHe2FEPSdN4X4nhNQ5XQQ/ qPTnfr5fSPcdCZjx0PD1KMaJZzBjr/dMcV/4VlTRcF19q57BRAmhwbsom0PDpBYVOnyGdbmxd9YPw bluyaCQJ19snLcWfUwpukxUxUJ1BkFyEcq6iW1obxeOs15cWQ38c/rI0Fo3WlulETtyCR9Unw7Hdu ivT2Xttw==; Received: from p200300fc1f0a8400f8379b3691e33d4b.dip0.t-ipconnect.de ([2003:fc:1f0a:8400:f837:9b36:91e3:3d4b]:52033) by sub2.freenet.de with esmtpsa (ID rissler.wolfgang@freenet.de) (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (port 465) (Exim 4.94.2 #2) id 1o5iUb-00By6D-80; Mon, 27 Jun 2022 08:45:05 +0200 Message-ID: <28b43f01-6fa0-e424-73e7-c6ba8435dd31@freenet.de> Date: Mon, 27 Jun 2022 08:44:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-GB To: Daniel Verite Cc: pgsql-general From: WR Subject: Re: Differences in Escaped bytea's when creating a plain pg_dump Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-FN-MUUID: 16563123050626ED228C1EO X-Originated-At: 2003:fc:1f0a:8400:f837:9b36:91e3:3d4b!52033 X-Scan-TS: Mon, 27 Jun 2022 08:45:05 +0200 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I'm back at my problem today: > Example: > > > postgres=# set standard_conforming_strings to off; > SET > > > postgres=# set escape_string_warning to off; > SET > > > postgres=# select '\000'::bytea; > ERROR: invalid byte sequence for encoding "UTF8": 0x00 > > > postgres=# select '\\000'::bytea; > bytea > ------- > \x00 > (1 row) I made some test with pgadmin. Pgadmin (5.2) also reports this error now. And it doesn't matter if standard_conforming_strings is on or off. SET standard_conforming_strings = off; INSERT INTO public.oned_figures VALUES (1, 'Figure_Wolle1', 476, -476, 2000, 2400, 2400, '\000', 500, 0, 'sinus(0|0|0;30;5;0;0,5;0)', '2021-08-31 11:53:22.442801', 0, 1); And SET standard_conforming_strings = on; INSERT INTO public.oned_figures VALUES (1, 'Figure_Wolle1', 476, -476, 2000, 2400, 2400, '\000', 500, 0, 'sinus(0|0|0;30;5;0;0,5;0)', '2021-08-31 11:53:22.442801', 0, 1); Both do report: WARNUNG: nicht standardkonforme Verwendung von Escape in Zeichenkettenkonstante LINE 8: ...(1, 'Figure_Wolle1', 476, -476, 2000, 2400, 2400, '\000\000&... ^ HINT: Verwenden Sie die Syntax für Escape-Zeichenketten, z.B. E'\r\n'. ERROR: FEHLER: ungültige Byte-Sequenz für Kodierung »UTF8«: 0x00 The warning can be avoided by adding the E before the string constant. The only solution to avoid the error is, to double-backslash. INSERT INTO public.oned_figures VALUES (1, 'Figure_Wolle1', 476, -476, 2000, 2400, 2400, E'\\000', 500, 0, 'sinus(0|0|0;30;5;0;0,5;0)', '2021-08-31 11:53:22.442801', 0, 1); I also dumped the table again after INSERT, and the data was correct (but again without E and with single backslash) What I cant understand: why does pg_dump produce the string without the E and without double-backslash, when it is needed? Now I have to write a correction routine in c++, what fixes the dumps, before using them. -- May the source be with you