Support for enums in btree_gin and btree_gist

I have just committed a series of patches that provide support for enum types in the btree_gin and btree_gist standard extensions. This is something I first started work on about a year ago. It turned out to be more involved that I had first thought it would be, as it requires some additional core code due to the way that enum comparisons work, which is a bit more complex than for most data types, and involves use of PostgresSQL’s internal caching mechanism.

The practical upshot of this, however, is that starting with PostgreSQL 10 you will be able to use enum columns in exclusion constraints. That’s something that could be very useful – I started this work when I found, somewhat to my surprise, that it wasn’t possible.



3 replies
  1. Adam
    Adam says:

    I just wanted to say thanks for the work on this. Now that uuid and enums are supported in exclusion constraints, I won’t have to support really ugly hacks I have in place now to just “get it working”. I was previously using uuid_send(uuid_val), and a custom function to get the enum oid (which I know is not safe) to index for my exclusion constraints. I cannot wait to get rid of the hacks.


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *