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 1o5mnw-0001XO-Eo for pgsql-general@arkaria.postgresql.org; Mon, 27 Jun 2022 11:21:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o5mmw-0008F2-R5 for pgsql-general@arkaria.postgresql.org; Mon, 27 Jun 2022 11:20:18 +0000 Received: from makus.postgresql.org ([72.32.157.229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o5mUE-0000Xs-VH for pgsql-general@lists.postgresql.org; Mon, 27 Jun 2022 11:00:59 +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 1o5mU8-0003X3-29 for pgsql-general@lists.postgresql.org; Mon, 27 Jun 2022 11:00:57 +0000 Received: from [195.4.92.122] (helo=sub3.freenet.de) by mout0.freenet.de with esmtpa (ID rissler.wolfgang@freenet.de) (port 25) (Exim 4.94.2 #2) id 1o5mU3-003V7w-QP for pgsql-general@lists.postgresql.org; Mon, 27 Jun 2022 13:00:47 +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:In-Reply-To:From: References:To:Subject: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WtmNjPioGieLyhZMvtpj1Ky5J7pqApO/CHvyuuNoyIE=; b=fsGGpdNTC9hwbTFif01UR+6iDO IjB0WTUPw/H/JIOLqRvdvfKcj1yIh8KtGb4gUr3KrZOtFk57JSZW/kXLCcYa9Qgai+/CFzUHnmrcw tNonIbh3IaLxTS5k6DDYGFutHr/qDA+LJMBo1oEdLkc6KrGCkgexJMfsdaXknge0kbKENiER/OWsA t+TReOOLt+dgWTje/jJCtPKn7qOJEwCDpsz04EU7tgYbNg3BKWBXIpHLf2VyFrdazOnVFFovaenS/ 60eIdBzB3QmFpMGgI42YCaLl7vcjlbSnA6AT2obN2/zqPOg+8Yd/ryj8cz5xzLxRYavdayKhkz5NY dvynMs3A==; Received: from p200300fc1f0a8400f8379b3691e33d4b.dip0.t-ipconnect.de ([2003:fc:1f0a:8400:f837:9b36:91e3:3d4b]:57616) by sub3.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 1o5mU3-00GJpo-3r for pgsql-general@lists.postgresql.org; Mon, 27 Jun 2022 13:00:47 +0200 Message-ID: Date: Mon, 27 Jun 2022 13:00:45 +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 Subject: Re: Differences in Escaped bytea's when creating a plain pg_dump Content-Language: en-GB To: pgsql-general@lists.postgresql.org References: From: =?UTF-8?Q?Wolfgang_Ri=c3=9fler?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-FN-MUUID: 16563276479080149F278CO X-Originated-At: 2003:fc:1f0a:8400:f837:9b36:91e3:3d4b!57616 X-Scan-TS: Mon, 27 Jun 2022 13:00:47 +0200 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Am 27.06.2022 um 12:12 schrieb Daniel Verite: > WR wrote: > >> First run worked. >> Second run worked. >> Then I changed to SET standard_conforming_strings = off; >> Third run worked. >> Fourth run throw the error >> Then I changed back to SET standard_conforming_strings = on; >> Fifth run throw the error too. >> And only adding E and second backslash helped. > > This kind of unstable behavior can be seen if the SET may not be > executed by the same session (same connection to the server) as the > subsequent queries. > SET affects only the session it's being run in. > > For instance a connection pooler configured in statement mode may > produce that behavior. The solution in the case of a connection pooler > is to group related statements into a transaction. > > Maybe pgAdmin has a pooler like that, but if you're issuing the statements > in the same SQL window, I would find it quite surprising that it doesn't > run them by the same session. > Or maybe you're mixing queries from different SQL windows that each > have their own connection, and in some cases you do the SET > in a window and the INSERT in another window. > Or maybe it's a pgAdmin bug. > > Ok, thank you Daniel, in all tests I put the SET statement before the INSERT in the same query tool and run it as a whole. (no statement was marked by mouse for single execution). So I agree with you, that one transmission is used by pgAdmin to run SET and INSERT. I always had a SET before each INSERT, so there could be no unknown state of standard_conforming_strings, no matter if pdAdmin uses different connections for each run of the script or the same again. The supplement of the second backslash in the c++ code costs me some nerves. Sending an statement std::string without doublebackslashes to pqxx::transaction results in the "0x00 is not a valid UTF8 sequence" error 21020 (as I wrote already). I'm afraid, I can't simply replace all backslashes in the whole dumptext with two of them. Since I found out now, that psql works nice with my dumpfiles, maybe its easier, to call psql from my code and not to use a pqxx::transaction. So I can also save myself loading the dump from the sql-file. The more I think about it, the more I love this idea. Thanks a lot, Wolfgang -- Wolfgang Rißler mailto: wolfgang.rissler@freenet.de mobil: +49 1520 9191759 - may the source be with you -