Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ge4gG-000863-Dg for pgsql-general@arkaria.postgresql.org; Mon, 31 Dec 2018 21:01:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ge4gE-0004IC-U7 for pgsql-general@arkaria.postgresql.org; Mon, 31 Dec 2018 21:00:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ge4gE-0004I2-I1 for pgsql-general@lists.postgresql.org; Mon, 31 Dec 2018 21:00:58 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ge4gA-0000mG-Vh for pgsql-general@postgresql.org; Mon, 31 Dec 2018 21:00:57 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 25FD92200E; Mon, 31 Dec 2018 16:00:54 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 31 Dec 2018 16:00:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=n Nn+tZedojq+tba7DR5eXA2lTdijROyPRE1KVbU8Hxs=; b=vjM9EYyv8Def4SSlX yVnf8LzWCsWSRc0ZPkUyRuts1bEpTnf5rjkGZOfYkDFBrnnDs0fgn9y7lJqhytxy mtYp7heF5yH+5/BiWqK7zZ7hylE3o3a4Ot6OeWBWwLneGd7O8NBXQddoz/C4NQ33 P1jAkaTSk44mxdB+Szf7sSWlV63gWlQya0GHWQdrkvf9ZXcFXU+ZkkbTat3dv0t4 PHElLnireEkK1J2BHhgT/7i5QV/Cx700SWSvHq3s+2BNrR4X2M6JK4hI5JIG4e0l 1XcGSwvntE0+TiccxqI736bBM5x2filLbZxyzrXyTkIP/400amAwYnZndHHUU0zR Qr7gg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=nNn+tZedojq+tba7DR5eXA2lTdijROyPRE1KVbU8H xs=; b=PxDyhbkuL8cc37CE0mQWEzAcxsvu7fkzIYL+h8nOVENSPQeIVSltPr9zM Bhq8KsROTniwF5xEVYxKZv8afrhsVfJuXJOszq7Q3S9fHNMbgNrWRoNBdigkAZJA NZIfs/iaqYjv863pWgVBHRbCVs8URb8t3HIoYUHy15YwajuxAo9AOYqEnYQo70KT GLu/GiXs7XAoDcrma/sjBZ877/i86fwYeASGnMll5o8ywA1xFRpGsbwC4tCXcP2R rNmGlGDKP9dO2MUw3FERprbLFSXB7DBZwocnRka/4sMm9Z15zWKXfPHxQToll8pA Ty89SMXmIe7aJhaVpgMOuEP6E7kNg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledruddvgddugeehucdltddurdegtdekrddttd dmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhht necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghdpphgrshhtvggsihhn rdgtohhmpdhgohhoghhlvggrphhishdrtghomhenucfkphepjeefrddvfeelrdduudejrd dvfeeknecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegr khhlrghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from ranger.suse (c-73-239-117-238.hsd1.wa.comcast.net [73.239.117.238]) by mail.messagingengine.com (Postfix) with ESMTPA id D9B2AE453B; Mon, 31 Dec 2018 16:00:52 -0500 (EST) Subject: Re: Can't quote_literal with COPY FROM PROGRAM To: Mark Mikulec Cc: pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: Date: Mon, 31 Dec 2018 13:00:52 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/31/18 12:58 PM, Mark Mikulec wrote: > I changed it to be just the single float value I needed to extract out > of the JSON object, but originally it was a text column that held the > entire JSON object. Might want to look at: https://www.postgresql.org/docs/10/datatype-json.html Might handle the escaping better. > ᐧ > > On Mon, Dec 31, 2018 at 3:52 PM Adrian Klaver > wrote: > > On 12/31/18 9:36 AM, Mark Mikulec wrote: > > Hi, > > > > This command, which generates a JSON object as output, has some > escaped > > data with backslashes: (see line 91 here: > https://pastebin.com/D4it8ybS) > > > > C:\\Portable\\curl\\curl.exe -k > > > "https://maps.googleapis.com/maps/api/directions/json?etcVariablesDeleted"' > > > > I use the COPY command to pull it into a temp table like so: > > > > COPY temp_maps_api from program 'C:\\Portable\\curl\\curl.exe -k > > > "https://maps.googleapis.com/maps/api/directions/json?etcVariablesDeleted"'; > > So temp_maps_api has a single JSON field? > > > > > However copy eats those backslashes. I need to use > quote_literal() but > > that's a syntax error. For some reason the COPY command doesn't > allow > > for ESCAPE to work with programs, only CSV. > > > > I tried using WITH BINARY but I get the error message: "COPY file > > signature not recognized" > > > > Does anyone know how to make COPY FROM PROGRAM take the output > literally? > > > > Thanks, > >    Mark > > ᐧ > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com