Postgres enum type


Is it possible to use postgresql native ENUM type in ormlite typed sql expressions?

CREATE TYPE my_enum_type AS ENUM ('some_value', 'other_value'');

I have tried using CustomField attribute

public class Table1
    public int Id { get; set; }

    public SomeEnum MyEnumField { get; set; }
public enum SomeEnum { SomeValue, OtherValue };

on inserting with

Db.Insert( new Table { SomeEnum = SomeEnum.SomeValue } 

it throws error:

column “my_enum_field” is of type my_enum_type but expression is of type text


No it isn’t possible and OrmLite is unlikely to support it since it’s not compatible across RDBMS’s and we have very specific behavior of how it handles string/int and recently char enums that works the same way across RDBMS’s.

But you can submit any feature requests to UserVoice to measure demand for it.