Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1akCGC-0005v1-ID for pgsql-bugs@arkaria.postgresql.org; Sun, 27 Mar 2016 15:05:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1akCGB-0005J6-Kb for pgsql-bugs@arkaria.postgresql.org; Sun, 27 Mar 2016 15:05:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1akCFY-0004Yq-Ib for pgsql-bugs@postgresql.org; Sun, 27 Mar 2016 15:05:08 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1akCFU-00032B-FW for pgsql-bugs@postgresql.org; Sun, 27 Mar 2016 15:05:07 +0000 MIME-Version: 1.0 Subject: BUG #14048: copy issues with jsonb To: pgsql-bugs@postgresql.org From: rotten@windfish.net Date: Sun, 27 Mar 2016 15:04:42 +0000 Message-ID: <20160327150442.2901.36148@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 14048 Logged by: Rick Otten Email address: rotten@windfish.net PostgreSQL version: 9.5.1 Operating system: Ubuntu 14.04 Description: I have a few jsonb columns in a table and I've run into several issues with COPY with that column type. I didn't see anything specific about it in the to-do list, and Google didn't turn up anyone else specifically complaining, so I'm filing it here. I apologize if this is a known issue. The table is the backend for a web pixel (tracking) service. It has 4 jsonb columns which contain variable data about the browser and session. (parsed user agent, list of cookies, query parameters, etc...) I wanted to copy a section of the table from one 9.5.1 database to another. For some reason the CSV and TEXT format exports do not quote/escape the nested JSON very well - after several tries, I gave up on that approach. The "copy to" output appears to be too mangled. It was not obvious, at first glance, where it is getting confused. Next I tried BINARY mode. That worked ok for the rows I was moving last week, but this week (for a different piece of the table) I'm getting the following when I try to read it back in: # copy (select * from pixels.pixel_requests where server_timestamp > '2016-03-26 00:00') to '/home/rotten/pixels27Mar2016.bin' binary; # copy pixels.pixel_requests_tmp_2 from '/home/rotten/pixels27Mar2016.bin' binary; ERROR: unsupported jsonb version number 63 CONTEXT: COPY pixel_requests_tmp_2, line 1, column parameters The new tmp table has the same ddl as the original table. Both tables are UTF-8 enabled. Both are the same version of PostgreSQL running on the same version of Ubuntu. I'm willing to share the copy output (313M - 288,000 rows) with someone who is able to help troubleshoot the issue, but I don't want to post the data in a public forum. I'm not sure which row and column is causing the copy command to fail. (There is already a to-do that may help with that.) Meanwhile, I'll use pg_dump to get the rows I need. Hopefully that will be able to extract and reload the jsonb data ok. pg_dump hasn't been a problem in the past anyway... -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs