【问题标题】:Postgres aws_s3 extention not accepting timestamp inputPostgres aws_s3 扩展不接受时间戳输入
【发布时间】:2022-01-10 19:35:17
【问题描述】:

我有一个带有类似 2021-05-27 11:57:23 的时间戳列的 csv,但 table_import_from_s3 函数(来自 aws_s3 postgres 扩展)一直给我这个错误:

ERROR:  invalid input syntax for type timestamp: "start_time"

是否有人使用此扩展成功导入了时间戳字段?

具有相同值的手动 INSERT 语句可以正常工作。

【问题讨论】:

  • 看起来问题在于aws_s3 扩展如何读取 CSV,因为start_time 是列标题,而不是值。

标签: postgresql amazon-rds postgresql-extensions


【解决方案1】:

问题是缺少 HEADER 参数,该参数被传递到扩展中的 postgres COPY 命令,因为我的 CSV 文件确实包含标题行。

之前

SELECT aws_s3.table_import_from_s3 (
  'my-table',
  '',
  '(format csv)',
  :'s3_uri'
);

之后

SELECT aws_s3.table_import_from_s3 (
  'my-table',
  '',
  '(format csv, header)',
  :'s3_uri'
);

【讨论】:

    猜你喜欢
    • 2016-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-14
    • 2018-11-14
    • 1970-01-01
    相关资源
    最近更新 更多