0

Redshift's new super data type uses partiql for querying. I have an array of data that is not nested eg: [0,1,2,3,4] What is the best way to query this data? All the documentation talks about nested arrays, but this is at the root level and there is no testing.

I have tried select supercolumnname[n] from tablewithsuper; and I am getting nulls, which isn't right.

Dan
  • 21
  • 1
  • 4

1 Answers1

0

The best way (that I know right now) is to unnest the array:

CREATE TEMPORARY TABLE my_table (my_array SUPER);
INSERT INTO my_table VALUES (JSON_PARSE('[10001,10002,3333]'));
SELECT m FROM my_table as t, t.my_array as m;
Ernesto
  • 605
  • 1
  • 13
  • 30
Hyruma92
  • 836
  • 8
  • 24