I have created a custom data type enum like so:
create type \"bnfunctionstype\" as enum ( \'normal\', \'library\', \'import\', \'thunk\',
SELECT (ENUM_RANGE(NULL::bnfunctionstype))[s] FROM generate_series(1, 5) s