summaryrefslogtreecommitdiff
path: root/contrib/btree_gin/btree_gin.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2018-04-05 18:19:10 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2018-04-05 18:19:10 +0300
commitf4cd7102b5a6097fb603c789728fbfd5d6fd43c5 (patch)
tree27d45b8ed6d705ab6959f4cc867baadd950de6a2 /contrib/btree_gin/btree_gin.c
parent0a64b45152b593c5eb95f2e88fbce7fbfe84ae7b (diff)
downloadpostgresql-f4cd7102b5a6097fb603c789728fbfd5d6fd43c5.tar.gz
Add support of bool, bpchar, name and uuid to btree_gin
Mostly for completeness, but I believe there are cases to use that in multicolumn GIN indexes. Bump btree_gin module version Author: Matheus Oliveira Reviewed by: Tomas Vondra Discussion: https://www.postgresql.org/message-id/flat/CAJghg4LMJf6Z13fnZD-MBNiGxzd0cA2=F3TDjNkX3eQH58hktQ@mail.gmail.com
Diffstat (limited to 'contrib/btree_gin/btree_gin.c')
-rw-r--r--contrib/btree_gin/btree_gin.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/contrib/btree_gin/btree_gin.c b/contrib/btree_gin/btree_gin.c
index 2473f79ca1..a660681e58 100644
--- a/contrib/btree_gin/btree_gin.c
+++ b/contrib/btree_gin/btree_gin.c
@@ -14,6 +14,7 @@
#include "utils/numeric.h"
#include "utils/timestamp.h"
#include "utils/varbit.h"
+#include "utils/uuid.h"
PG_MODULE_MAGIC;
@@ -350,6 +351,8 @@ leftmostvalue_text(void)
GIN_SUPPORT(text, true, leftmostvalue_text, bttextcmp)
+GIN_SUPPORT(bpchar, true, leftmostvalue_text, bpcharcmp)
+
static Datum
leftmostvalue_char(void)
{
@@ -437,7 +440,6 @@ GIN_SUPPORT(numeric, true, leftmostvalue_numeric, gin_numeric_cmp)
* routines it needs it, so we can't use DirectFunctionCall2.
*/
-
#define ENUM_IS_LEFTMOST(x) ((x) == InvalidOid)
PG_FUNCTION_INFO_V1(gin_enum_cmp);
@@ -477,3 +479,30 @@ leftmostvalue_enum(void)
}
GIN_SUPPORT(anyenum, false, leftmostvalue_enum, gin_enum_cmp)
+
+static Datum
+leftmostvalue_uuid(void)
+{
+ /* palloc0 will create the UUID with all zeroes: "00000000-0000-0000-0000-000000000000" */
+ pg_uuid_t *retval = (pg_uuid_t *) palloc0(sizeof(pg_uuid_t));
+ return UUIDPGetDatum(retval);
+}
+
+GIN_SUPPORT(uuid, false, leftmostvalue_uuid, uuid_cmp)
+
+static Datum
+leftmostvalue_name(void)
+{
+ NameData* result = (NameData *) palloc0(NAMEDATALEN);
+ return NameGetDatum(result);
+}
+
+GIN_SUPPORT(name, false, leftmostvalue_name, btnamecmp)
+
+static Datum
+leftmostvalue_bool(void)
+{
+ return BoolGetDatum(false);
+}
+
+GIN_SUPPORT(bool, false, leftmostvalue_bool, btboolcmp)