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 1o4OWw-0007C2-4z for pgsql-general@arkaria.postgresql.org; Thu, 23 Jun 2022 15:14:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o4OWv-0001Nz-0x for pgsql-general@arkaria.postgresql.org; Thu, 23 Jun 2022 15:14:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4OWu-0001Nk-KU for pgsql-general@lists.postgresql.org; Thu, 23 Jun 2022 15:14:00 +0000 Received: from mout0.freenet.de ([2001:748:100:40::2:2]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4OWr-0003NR-K5 for pgsql-general@lists.postgresql.org; Thu, 23 Jun 2022 15:13:59 +0000 Received: from [195.4.92.120] (helo=sub1.freenet.de) by mout0.freenet.de with esmtpa (ID rissler.wolfgang@freenet.de) (port 25) (Exim 4.94.2 #2) id 1o4OWm-008dIU-N6 for pgsql-general@lists.postgresql.org; Thu, 23 Jun 2022 17:13:52 +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:To: MIME-Version:Date:Message-ID:Sender:Reply-To:Cc: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=oQLyH2+glOAJWUixgbxsZ1ijyR48J26UcMjvOgNDO8Y=; b=YJhwUxBzFtXpvzR/5nlA3XwABN IZQ1PrH5Efxz+eW6QKarzrvLCJV6dbkYgkPyqORzHCcqfErDweLac+eaANHHDGstqeoi0ovaWqE92 Bor7/QUk0UjImrjReFQkUsMYtUxMNSviIT7ZC7j10I9ZmjsO2VL9RIK6yiUTcrK554X7C9zeGvcpY PMvO8SBmyTaRRWQR2J2KFkVupMcmvLGabVQxu6jfsY5vOIcQbry20TMqP72wm7gl/hWn6afu2PhSs ZdYao9DBaC9XP/ghMDqhPstx24X99JrRtkmGlH7E7A6ulZl6Rl/xpojByJ0W7IoSDE9xxOOajryuD 9hArr6LA==; Received: from p200300fc1f0a8400198adaeab810371b.dip0.t-ipconnect.de ([2003:fc:1f0a:8400:198a:daea:b810:371b]:54870) by sub1.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 1o4OWm-006C1c-0J for pgsql-general@lists.postgresql.org; Thu, 23 Jun 2022 17:13:52 +0200 Message-ID: <4d2ad6be-560b-64de-ea12-f4e5f1b71992@freenet.de> Date: Thu, 23 Jun 2022 17:13:50 +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: pgsql-general From: WR Subject: Differences in Escaped bytea's when creating a plain pg_dump Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-FN-MUUID: 1655997232A0CCF76131C8O X-Originated-At: 2003:fc:1f0a:8400:198a:daea:b810:371b!54870 X-Scan-TS: Thu, 23 Jun 2022 17:13:52 +0200 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello community, I've some trouble in restoring a plain text pg_dump. Postgres version is 13 x64 running on Windows10x64 installed from EDB package. The database has bytea_output = 'escape' option because of some processing software needs it for historical reasons. Dump command is: pg_dump --file=mydump.sql --format=plain --verbose --encoding=UTF8 --schema=public --host=localhost --username=myuser --inserts dbname We have two tables that have a bytea-row. But when I look at the dumpfile there is a difference between the escaped bytea-string. (note: both INSERT's from the same run of pg_dump in the dumpfile) SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off; [snip] INSERT INTO public.oned_figures VALUES (1, 'Figure_Wolle1', 476, -476, 2000, 2400, 2400, '\000\000&\001\334\001\334\001&\001\000\000\332\376$\376$\376\332\376\000\000&\001\334\001\334\001&\001\000\000\332\376$\376$\376\332\376\000\000&\001\334\001\334\001&\001\000\000\332\376$\376$\376\332\376\000\000&\001\334\001\334\001&\001\000\000\332\376$\376$\376\332\376\000\000&\001\334\001\334\001&\001\000\000\332\376$\376$\376\332\376\000\000&\001\334\001\334\001&\001\000\000\332\376$\376$\376\332\376\000\000', 500, 0, 'sinus(0|0|0;30;5;0;0,5;0)', '2021-08-31 11:53:22.442801', 0, 1); [snip] INSERT INTO public.profiles VALUES (1, 1, 's', 152, '\\037\\003\\000\\000\\000\\037\\003\\000\\000\\000\\037\\003\\000\\000\\000\\037\\003\\000\\000\\000!\\003\\000\\000\\000!\\003\\000\\000\\000!\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000\\000\\000"\\003\\000', '2016-08-25 00:00:00+02'); [snip] When I restore them via pgadmin4 query tool, both INSERTS do work. But when I read them with my c++ written software from file and send them with pqxx-Library as a transaction, the first bytea-string generates a fault 21020. (0x00 is not a valid utf8 sequence). I also checked the read string in c++ debugger, the single backslashes in the one case and the double backslashes in the other case are there. So my questions are: Why do we get one bytea-string with double backslashes (which works) and another one with single backslashes (which actually not works with pqxx-transactions)? Can I convince pg_dump somehow, to generate double backslashes in all bytea-strings? Why does pgadmin understand both formats. pqxx-transaction does not? Thank you for this great database-system. I really like it. Wolfgang -- May the source be with you