From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Cc: | Kiran K V <kirankv(dot)1982(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: ERROR: invalid byte sequence for encoding UTF8: 0x00 |
Date: | 2024-01-09 15:48:28 |
Message-ID: | 2186784.1704815308@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> On Tue, 2024-01-09 at 17:48 +0530, Kiran K V wrote:
>> I have a table with bytea column and trying to load the data using copy command.
>> But Copy command is failing with
>> "ERROR: invalid byte sequence for encoding UTF8: 0x00.
>> Why postgresql is failing to load when data contains 0x00.
>> How to resolve this error ? any workaround to load the data with 0x00 values ?
> This is not about loading data into a "bytea", but into a "text", "varchar" or
> "char" column. Check again.
I am guessing that the OP tried to put a literal NUL character
into the COPY data. A bytea value in COPY data needs to be
text-encoded as per one of the alternatives explained in the
manual. Alternatively, you could jump through the hoops involved
in sending binary COPY data.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2024-01-09 16:00:09 | Re: Unable to install postgresql and pgadmin |
Previous Message | Laurenz Albe | 2024-01-09 15:13:28 | Re: ERROR: invalid byte sequence for encoding UTF8: 0x00 |