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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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.