【问题标题】:Redshift error : column is of type timestamp without time zone but expression is of type characterRedshift 错误:列是没有时区的时间戳类型,但表达式是字符类型
【发布时间】:2021-06-18 18:56:20
【问题描述】:

我正在将记录从外部表复制到 redshift 内部的表中。

当我对外部表运行查询时,它会获取我所有的列和记录

SELECT b.title,b.link,b.author,b.published_date,category
FROM  jatinspectrum.extable a, a.enteries b,b.category category

现在,当我尝试运行复制记录时,它会引发错误

ERROR: column "published_date" is of type timestamp without time zone but expression is of type character varying Hint: You will need to rewrite or cast the expression.

我对复制记录的查询(这里 jatinanalysis is redshift table 和 jatinspectrum.extable 是 external table

insert into jatinanalysis
select b.title,b.link,b.author,cast(b.published_date as timestamp),category
FROM  jatinspectrum.extable a, a.enteries b,b.category category

【问题讨论】:

  • JOINJOINJOIN。你真的想要笛卡尔积吗?如果你这样做了,你应该明确地使用CROSS JOIN
  • 你能给我一个例子吗@GordonLinoff 以便我学习它。
  • 。 .只需将逗号替换为CROSS JOIN
  • 使用交叉连接比我的方法有什么好处

标签: sql amazon-web-services amazon-redshift amazon-redshift-spectrum


【解决方案1】:

我使用了错误的语法

insert into jatinanalysis (title,url,author,published_date,category)
select b.title,b.link,b.author,b.published_date,category
FROM  jatinspectrum.extable a, a.enteries b,b.category category

【讨论】:

    猜你喜欢
    • 2020-02-17
    • 2015-11-26
    • 2019-11-08
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 2015-11-09
    • 2021-12-27
    • 2018-12-31
    相关资源
    最近更新 更多