kysely-data-api
kysely-data-api copied to clipboard
Support for Array of Enums
I want to define a column which is an array of enum values, but whilst I can create the table and execute an INSERT, I can’t select the record back and I get this error
BadRequestException: Array of type 'zones' is not supported
and it fails in the Console RDS window if I just try SELECT * FROM product
.
Here is a sql fiddle of what I'm trying to support
See discussion on slack here
One workaround is to cast the enum type to a text
type before aggregating it into an array. For instance, if your enum type is called my_enum_type
, you could do this:
SELECT some_column, array_agg(my_enum_column::text) AS enum_array
FROM your_table
GROUP BY some_column;