gist-boxpoint-support.patch

text/x-patch

Filename: gist-boxpoint-support.patch
Type: text/x-patch
Part: 0
Message: Patch: add GiST support for BOX @> POINT queries

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/access/gist/gistproc.c 0 0
src/include/catalog/pg_amop.h 0 0
diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/gistproc.c
index 86a5d90..a2c6cb6 100644
*** a/src/backend/access/gist/gistproc.c
--- b/src/backend/access/gist/gistproc.c
*************** gist_box_consistent(PG_FUNCTION_ARGS)
*** 96,101 ****
--- 96,113 ----
  	if (DatumGetBoxP(entry->key) == NULL || query == NULL)
  		PG_RETURN_BOOL(FALSE);
  
+ 	if (strategy == 27)
+ 	{
+ 	    /* Convert BOX @> POINT to the equivalent BOX @> BOX query */
+ 	    Point *q_point = PG_GETARG_POINT_P(1);
+ 	    BOX q_box;
+ 
+ 		q_box.low = *q_point;
+ 		q_box.high = *q_point;
+ 		query = &q_box;
+ 		strategy = 7;       /* Strategy number for BOX @> BOX */
+ 	}
+ 
  	/*
  	 * if entry is not leaf, use rtree_internal_consistent, else use
  	 * gist_box_leaf_consistent
diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h
index aabb900..eb03255 100644
*** a/src/include/catalog/pg_amop.h
--- b/src/include/catalog/pg_amop.h
*************** DATA(insert (	2593   603 603 11 s 2573 7
*** 595,600 ****
--- 595,601 ----
  DATA(insert (	2593   603 603 12 s 2572 783 0 ));
  DATA(insert (	2593   603 603 13 s 2863 783 0 ));
  DATA(insert (	2593   603 603 14 s 2862 783 0 ));
+ DATA(insert (	2593   603 600 27 s 433 783 0 ));
  
  /*
   * gist point_ops