2013/8/23 Lukas Eder <[email protected]> > > 2013/8/23 <[email protected]> > > I have to correct myself :( >> "When an enum type is created, its members are assigned sort-order >> positions 1..n. But members added later might be given negative or >> fractional values of enumsortorder. The only requirement on these values >> is that they be correctly ordered and unique within each enum type." >> "ALTER TYPE name ADD VALUE new_enum_value [ { BEFORE | AFTER } >> existing_enum_value ]" >> >> So, one can add values to the type that have a higher oid, but a lower >> enumorder. >> The workaround will only work as long one does not alters the type by >> adding values >> in the sort order "BEFORE" :( >> > > Jeez, thanks for that insight. I'll run that question by Stack Overflow. > Someone will give us an authoritative answer, I'm sure. Maybe there's an > internal stored function for the task: > http://stackoverflow.com/q/18398590/521799 > > From what I understand, the OID ordering is *mostly but not > always*backwards-compatible... >
It seems as though we have an answer: http://stackoverflow.com/a/18399022/521799 jOOQ will have to order the enum literals by casting the label to the enum type. PostgreSQL surely has its ways: SELECT enumlabel, row_number() OVER (ORDER BY enumlabel::test_enum) AS sort_keyFROM pg_catalog.pg_enumWHERE enumtypid = 'test_enum'::regtype; Cheers Lukas -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
