Suppose there's an enum days_of_the_week with values from 'Sunday' to 'Saturday'.
Now, let's suppose that we have a table with columns company_name and days, where days is an array which represents what days the company is active.
In that case, we would want the values of the array to be compatible with the enum and for the values to be unique within the array (e.g. not allow two Mondays' in one value).
Is there any datatype which would handle all this and have the benefit of optimizing lookup queries?
checkconstraints. But enums and arrays are pretty much anti-patterns when doing a proper relational design. If you normalize this properly you can easily get this using a unique index