获取用于编码“UTF8"的“无效字节序列:0x00";在 postgresql 中执行 aws_s3.table_import_from_s3 命令时出错 [英] Getting "invalid byte sequence for encoding "UTF8": 0x00" error when executing aws_s3.table_import_from_s3 command in postgresql

查看:53
本文介绍了获取用于编码“UTF8"的“无效字节序列:0x00";在 postgresql 中执行 aws_s3.table_import_from_s3 命令时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在执行时遇到以下错误:

I am getting below error when executing :

SELECT aws_s3.table_import_from_s3(   'test',  
'a,b,c,d,e',   
'(format csv)',  
'abc-ttt-dev',
   'outer/inner/Inbound/sample.csv',
   'us-east-1'
);

SQL 错误 [22021]:错误:编码UTF8"的字节序列无效:0x00哪里: COPY 测试,第 1 行SQL 语句copy test (a,b,c,d,e) from '/rdsdbdata/extensions/aws_s3/amazon-s3-fifo-6826-20210708T140854Z-0' with (format csv)"

SQL Error [22021]: ERROR: invalid byte sequence for encoding "UTF8": 0x00 Where: COPY test, line 1 SQL statement "copy test (a,b,c,d,e) from '/rdsdbdata/extensions/aws_s3/amazon-s3-fifo-6826-20210708T140854Z-0' with (format csv)"

仅供参考,以下查询工作正常.

Just for information, Below query works perfectly fine.

SELECT aws_s3.table_import_from_s3(
   'test',
   'a,b,d,e',
   'DELIMITER ''|''', 
   'abc-ttt-dev',
   'outer/inner/Inbound/sample.txt',
   'us-east-1'
);

表脚本是

CREATE TABLE test (
    a text not NULL,
    b text not NULL,
    c text not NULL,
    d text not NULL,
    e text not NULL
);

推荐答案

我认为您的 csv 文件中有 NULL 值,这就是您收到此错误的原因.

I think there are NULL values in your csv file and that is the reason you get this error.

您可以使用 lambda 预处理文件或参考 插入时出现 Postgres 错误 - 错误:用于编码UTF8"的无效字节序列:0x00 用于其他解决方法.

You can either pre process the file using lambda or refer to Postgres error on insert - ERROR: invalid byte sequence for encoding "UTF8": 0x00 for other workarounds.

这篇关于获取用于编码“UTF8"的“无效字节序列:0x00";在 postgresql 中执行 aws_s3.table_import_from_s3 命令时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆