0

I'm trying to save a generated date series in a temporary table on redshit:

drop table if exists date_list;
create temporary table date_list as
with seq as(
select date '2020-02-27' + i as dt
from generate_series(1, (date '2020-12-01' - date '2020-02-27')) i
)
select * from seq;

But received the following error:

[Code: 500310, SQL State: 0A000]  [Amazon](500310) Invalid operation: Specified types or functions (one per INFO message) not supported on Redshift tables.;

I do not what part of the code caused this error since the syntax should be right.

lydias
  • 841
  • 1
  • 14
  • 32

1 Answers1

0

Yes, generate_series() is a leader-node-only function and its results cannot be used on the compute nodes. The way to do this is with a recursive cte. See:

trying to create a date table in Redshift

Bill Weiner
  • 8,835
  • 2
  • 7
  • 18