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 1mtFJ3-0000Uh-Pu for pgsql-general@arkaria.postgresql.org; Fri, 03 Dec 2021 20:37:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mtFJ1-0001tF-V8 for pgsql-general@arkaria.postgresql.org; Fri, 03 Dec 2021 20:37:19 +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 1mtFJ0-0001t4-1R for pgsql-general@lists.postgresql.org; Fri, 03 Dec 2021 20:37:19 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mtFIs-00032E-T2 for pgsql-general@postgresql.org; Fri, 03 Dec 2021 20:37:17 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 853883200E31; Fri, 3 Dec 2021 15:37:08 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 03 Dec 2021 15:37:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:mime-version:subject:to:references:from :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=q Brh1ls4HG5wefrlRvYjsYgJxc6vS98WhBbBW94iumY=; b=WQveFdwnG2TiA69HD Pscm5/kohAr2u8SlvZy+SEwz5QL99y7VED9lt4Vn6yYXLO2+PEmWg7j02FN1vCDd 1Jolz66BIgAnA2INCEWx8ql65Eqcz43IaVzKcX3a14FZAgpAB2peaMv5zw4aGjmB Jirvrs+TY+5ghObOhWxZl18kHk6qRBSsJI0SYTObBlbNYSVAqBBQvSvFTeD2CWmZ nJs13Ii3BdtyB9zwF1b6/EaeKaiKJMAk0oNii+Irh4A2WcP3N5jwJoi0RvuKnf82 6JWYptZaWZiPuzgj2S1APsmGM9PW6ilOAQ61j0q8xgZJ3o1wDdq3PfU6fOAaFSNo 2AsDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=qBrh1ls4HG5wefrlRvYjsYgJxc6vS98WhBbBW94iu mY=; b=V7P9QRUhSuJag0YCp5clmiDtMl1JvbgoRpUUMLm/VNnWNIQ2k51FCngWU UE4SkarVJ5mSrjNg2nvK5zMJf9Eh90bAlvtAnV58auq+1pkLsyTcZYtxhkP08uPi XZqMIoJKzWKcPqzzJ0o+Sx+3fhRnPqgP2YI1cujCtSCTlKMzWNYwWniqVlYuz5TI NcCitqFI5vzW+TNOilqln7Ehec1+6ZcssBs/SIBxdBFT8UT722EaJObqR1aBmH/Y nWoJiqN7pmhcdh3I0UeXmDn7UHL8Q5nW3Rere9A3Mtl9SKzY0DHyfL0pE1OmfcCp bY/qP2X7VJG1FfkSRX2OfwrKSnaBg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrieejgddugedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeeuveetgffhiedtvddtheeifffgffdvleelvddthedu gfehkeeivddtkeffgeffhfenucffohhmrghinhepphhshigtohhpghdrohhrghdpphhosh htghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 Dec 2021 15:37:06 -0500 (EST) Message-ID: <58ae5076-2faa-db4a-2919-9d2ffc650fdd@aklaver.com> Date: Fri, 3 Dec 2021 12:37:06 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: Insert binary file into bytea where PG server does not have access to the file ? Content-Language: en-US To: David Gauthier , Postgres General References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/3/21 12:13, David Gauthier wrote: > 11.5 on linux > > Big corp with an IT dept providing us with PG DBs running in instances > on their servers. (We/I amd not DBA).    We on the client side, the > "users" of these DBs, want to load binary files into bytea type > columns.  But the files we want to load are on disks that the server > does not have access to. > > I googled around for a solution.  This failed... > > insert into test_bytea (id,data) values > (1,pg_read_binary_file('/top/next.whatever/xyz.bin')::bytea); > > ERROR:  could not stat file "/top/next.whatever/xyz.bin": No such file > or directory > > Understandable because the server hasn't even mounted /top. > > Is there a way to do what I want from the client side ? Are you using some client side language(Java, Python, etc) library? They generally have a way to deal with this: Python via psycopg2: https://www.psycopg.org/docs/usage.html#adapt-binary Java via JDBC: https://jdbc.postgresql.org/documentation/head/binary-data.html > If the file is transformed into some titanic string on the client side, > then passed along over the net to the server in the insert statement, is > there a max string length that I need to worry about ? > > Thanks -- Adrian Klaver adrian.klaver@aklaver.com