Re: btree_gin and btree_gist for enums

Matt Wilmas <pgsql_lists@realplain.com>

From: "Matt Wilmas" <pgsql_lists@realplain.com>
To: "Andrew Dunstan" <andrew@dunslane.net>, "PostgreSQL-development" <pgsql-hackers@postgresql.org>
Date: 2016-03-24T16:40:48Z
Lists: pgsql-hackers
Hi Andrew, all,

First message here!  I didn't get around to sending an intro/"thank you all" 
e-mail yet, and a small performance (?) patch+idea(s)...  (CPU stuff, since 
I don't otherwise know much about PG internals.)  Anyway...

----- Original Message -----
From: "Andrew Dunstan"
Sent: Thursday, March 17, 2016

> Here is a patch to add enum support to btree_gin and btree_gist. I
> didn't include distance operations, as I didn't think it terribly
> important, and there isn't a simple way to compute it sanely and
> efficiently, so no KNN support.

Major thanks for coming up with this a week after your "enums and indexing" 
message.  My love of all things Postgres has a lot to do with being able to 
do nearly anything one could want (coming from MySQL :-/)!  So I was like, 
"Wait, what?" when you brought up the subject, since this was something I 
hadn't actually tried, but was planning to use btree_gin/gist with a good 
mix of stuff, including enums (array and scalar).

At first I thought it was just arrays of enums, until this patch for the 
contrib extensions (for the btree parts with GIN/GiST; plus GiST 
exclusion?), and your blog posts... [1][2]  I wasn't certain from the second 
post whether your array solution can be used today without this patch (yes, 
just tried 9.5).  So, two separate issues, and the patch addresses scalar 
stuff, IIUC.

It would be *really* nice to have this in 9.6.  It seems it's simply filling 
out functionality that should already be there, right?  An oversight/bug fix 
so it works "as advertised?" :-)  Is any other btree type-compatibility 
missing from these modules?  (I notice the btree_gin docs don't mention 
"numeric," but it works.)

I just looked over the patch, and the actual code addition/changes seem 
pretty small and straightforward (or am I wrong?).  And it's not changing 
anything in the core, so...

Well, just wanted to argue my case! :^)

[1] http://adpgtech.blogspot.com/2016/03/gist-and-gin-support-for-enums.html
[2] http://adpgtech.blogspot.com/2016/03/gin-indexing-array-of-enums.html

> cheers
>
> andrew

Thanks,
Matt 



Commits

  1. Add btree_gin support for enum types

  2. Add btree_gist support for enum types.

  3. Use CallerFInfoFunctionCall with btree_gist for numeric types

  4. Add a direct function call mechanism using the caller's context.

  5. Add support for EUI-64 MAC addresses as macaddr8

  6. Add an Assert that enum_cmp_internal() gets passed an FmgrInfo pointer.