Re: copy error with json/jsonb types

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: tao tony <tonytao0505(at)outlook(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: copy error with json/jsonb types
Date: 2017-11-30 23:06:11
Message-ID: CAB7nPqTs96YMBe7FuFzCSn=EOJrVpc4hT0sOURkHiNKgZS3-Fw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Nov 30, 2017 at 3:01 PM, tao tony <tonytao0505(at)outlook(dot)com> wrote:
> hi dears,
>
>
> I'm using copy and jdbc copyin to build load data to pg,data type in table
> is jsonb.postgresql version are 9.6 and 10.0.
>
> Some records with escape characters would be failed with error"ERROR:
> invalid input syntax for type json"
>
> but when using insert they could be executed successfully.
>
> please kindly tell me how to fix this issue?

The lookup of JSON strings is done in json_lex_string(). If I
copy-paste the upthread values into a manual INSERT the tuples get
inserted, operation done using UTF-8. And both json and jsonb are
proving to work.
--
Michael

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alan Hodgson 2017-11-30 23:49:28 Re: ERROR: could not load library libperl.so, PostgreSQL trying to CREATE EXTENSION plperlu
Previous Message Ben Nachtrieb 2017-11-30 22:59:00 RE: ERROR: could not load library libperl.so, PostgreSQL trying to CREATE EXTENSION plperlu