Redshift View Casting Data as Super Type

In Redshift, how can I cast object as a Super Type in view creation ? for example, I want to select 1, 2, cast ((select 3,4) AS SUPER) ;

I found this page explaining how to use super type, but this does not explain how to cast super type in a view

1 Answer

The JSON_PARSE() function is the easiest way to do this. This function takes a string as an argument and as you can form this json string from any information you have in your query. JSON_PARSE() returns a super type.

Your example doesn't makes sense as if isn't a json and doesn't map to a super. Here's an example that might help.

select A, B, 
    json_parse('[' || C || ', ' || D || ']') as S
FROM (select 1 as A, 2 as B, 3 as C, 4 as D);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest