generate_series() method fails in Redshift

前端 未结 7 1476
时光说笑
时光说笑 2020-11-27 22:01

When I run the SQL Query:

 select generate_series(0,g)
 from ( select date(date1) - date(date2) as g from mytable ;

It returns an error:

7条回答
  •  无人及你
    2020-11-27 22:19

    You are not using PostgreSQL. You are using Amazon Redshift.

    Amazon Redshift does not support generate_series when used with Redshift tables. It says it right there in the error message.

    Either use real PostgreSQL, or if you need Redshift's features, you must also work within the limitations of Redshift.

    Your second example works because it does not use any Redshift tables.

提交回复
热议问题