Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WUc6w-0003hz-HH for pgsql-bugs@arkaria.postgresql.org; Mon, 31 Mar 2014 13:18:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WUc6v-0002fb-Ox for pgsql-bugs@arkaria.postgresql.org; Mon, 31 Mar 2014 13:18:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WU1wz-0002Aa-Vo for pgsql-bugs@postgresql.org; Sat, 29 Mar 2014 22:42:06 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WU1wx-00088u-1k for pgsql-bugs@postgresql.org; Sat, 29 Mar 2014 22:42:05 +0000 MIME-Version: 1.0 Subject: BUG #9776: well formed json with embedd colon ':' causes error on copy To: pgsql-bugs@postgresql.org From: larry.price@enterprisedb.com Date: Sat, 29 Mar 2014 22:41:45 +0000 Message-ID: <20140329224145.342.43172@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.2 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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: 9776 Logged by: Larry Price Email address: larry.price@enterprisedb.com PostgreSQL version: 9.3.3 Operating system: CENTOS Description: using a simple table with json datatype Table "test.testset" Column | Type | Modifiers --------+------+----------- tune | json | attempt to insert the following json (well formed according to jq, python simplejson and other parsers --- { "title": "Rinaldo : Act 1 \"Cor ingrato, ti rammembri\" [Rinaldo]", "track_id": "TRBBIYX128F1497FF2", "tags": [], "similars": [], "timestamp": "2011-09-14 11:38:47.924559", "artist": "Marilyn Horne" } ___ attempting to insert using psql \copy results: psql -U test -d test -c '\copy testset (tune) from stdin' ERROR: invalid input syntax for type json DETAIL: Token "Cor" is invalid. CONTEXT: JSON data, line 1: ...BBIYX128F1497FF2", "title": "Rinaldo : Act 1 "Cor... COPY testset, line 1, column tune: "{"artist": "Marilyn Horne", "timestamp": "2011-09-14 11:38:47.924559", "similars": [], "tags": [], "..." it seems to be stripping the escape sequences before the json is parsed. Could be user error. But it appears that strings are not getting escaped properly before being parsed as json, but only when the copy statement is used. Other json from the same set gets properly inserted. using insert with the same value works --- insert into testset (tune) values ('{ "title": "Rinaldo : Act 1 \"Cor ingrato, ti rammembri\" [Rinaldo]", "track_id": "TRBBIYX128F1497FF2", "tags": [], "similars": [], "timestamp": "2011-09-14 11:38:47.924559", "artist": "Marilyn Horne" }' ); --- -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs