Re: Invalid byte sequence

Поиск
Список
Период
Сортировка
От Holger Jakobs
Тема Re: Invalid byte sequence
Дата
Msg-id c30c40b2-721f-7fb9-7973-4a65f89d8e4b@jakobs.com
обсуждение исходный текст
Ответ на Invalid byte sequence  (Yambu <hyambu@gmail.com>)
Ответы Re: Invalid byte sequence  (Yambu <hyambu@gmail.com>)
Список pgsql-admin

How many lines has the file? Maybe line 377617 is the last one.

If so, you can just remove the last line containing this 0x00. The following command can do this for you:

sed -i '$ d' /outputfile.csv

May I remark that having a file in the / directory is a bit awkward? This directory should not be writable by any user (except root, and root doesn't fiddle with files for a database).



Am 01.07.21 um 09:29 schrieb Yambu:
Hello

How do i get past the error below. I have created a foreign table which points to a csv file and when i try to create another table it gives error below

The csv file has funny characters, how do i bypass those characters.

create foreign table table1
(
id int,
name text
)
SERVER local_file
OPTIONS (filename '/outputfile.csv' ,
format 'csv',
header 'TRUE',
delimiter ';'
);


create table2 as select * from table1;

ERROR:  invalid byte sequence for encoding "UTF8": 0x00
CONTEXT:  COPY table1, line 377617
-- 
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
Вложения

В списке pgsql-admin по дате отправления:

Предыдущее
От: Yambu
Дата:
Сообщение: Re: Invalid byte sequence
Следующее
От: Yambu
Дата:
Сообщение: Re: Invalid byte sequence