[SCM] PostGIS branch master updated. 3.4.0rc1-828-g38d9c69f1
git at osgeo.org
git at osgeo.org
Fri Dec 1 16:02:10 PST 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, master has been updated
via 38d9c69f1dd5c0061d254d190aeb38795edea9d4 (commit)
from c1dbf8ef0007f8230b1ec76e4b3f9d079647dcb2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 38d9c69f1dd5c0061d254d190aeb38795edea9d4
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Dec 1 16:01:43 2023 -0800
More support for EMPTY keys in 2d index. Closes #5632.
diff --git a/postgis/gserialized_gist_2d.c b/postgis/gserialized_gist_2d.c
index 576c82838..a474060d9 100644
--- a/postgis/gserialized_gist_2d.c
+++ b/postgis/gserialized_gist_2d.c
@@ -560,6 +560,16 @@ gserialized_datum_get_box2df_p(Datum gsdatum, BOX2DF *box2df)
{
result = box2df_from_gbox_p(&gbox, box2df);
}
+ else {
+ /* Oh dear, has someone fed us an empty? */
+ POSTGIS_FREE_IF_COPY_P(gpart, gsdatum);
+ gpart = (GSERIALIZED *)PG_DETOAST_DATUM(gsdatum);
+ if (gserialized_is_empty(gpart))
+ {
+ box2df_set_empty(box2df);
+ return LW_SUCCESS;
+ }
+ }
}
POSTGIS_FREE_IF_COPY_P(gpart, gsdatum);
@@ -868,10 +878,19 @@ Datum gserialized_gist_compress_2d(PG_FUNCTION_ARGS)
/* Extract our index key from the GiST entry. */
result = gserialized_datum_get_box2df_p(entry_in->key, &bbox_out);
- /* Is the bounding box valid (non-empty, non-infinite)? If not, return input uncompressed. */
- if ( result == LW_FAILURE )
+ if (result == LW_FAILURE)
+ {
+ /* Treat failure like NULL */
+ POSTGIS_DEBUG(4, "[GIST] leafkey is null");
+ gistentryinit(*entry_out, (Datum) 0, entry_in->rel,
+ entry_in->page, entry_in->offset, false);
+ POSTGIS_DEBUG(4, "[GIST] returning copy of input");
+ PG_RETURN_POINTER(entry_out);
+ }
+
+ /* Is the bounding box empty? Done! */
+ if (box2df_is_empty(&bbox_out))
{
- box2df_set_empty(&bbox_out);
gistentryinit(*entry_out, PointerGetDatum(box2df_copy(&bbox_out)),
entry_in->rel, entry_in->page, entry_in->offset, false);
diff --git a/regress/core/regress_brin_index_3d_expected b/regress/core/regress_brin_index_3d_expected
index 6cbaf0894..b80bee3ec 100644
--- a/regress/core/regress_brin_index_3d_expected
+++ b/regress/core/regress_brin_index_3d_expected
@@ -11,6 +11,7 @@ scan_seq|Seq Scan
1259|POINT Z (125.9 125.9 125.9)
1260|POINT Z (126 126 126)
scan_seq|Seq Scan
+1100|POINT Z EMPTY
1250|POINT Z (125 125 125)
1251|POINT Z (125.1 125.1 125.1)
1252|POINT Z (125.2 125.2 125.2)
@@ -22,7 +23,24 @@ scan_seq|Seq Scan
1258|POINT Z (125.8 125.8 125.8)
1259|POINT Z (125.9 125.9 125.9)
1260|POINT Z (126 126 126)
+2200|POINT Z EMPTY
+3300|POINT Z EMPTY
+4400|POINT Z EMPTY
+5500|POINT Z EMPTY
+6600|POINT Z EMPTY
+7700|POINT Z EMPTY
+8800|POINT Z EMPTY
+9900|POINT Z EMPTY
+12100|POINT Z EMPTY
+13200|POINT Z EMPTY
+14300|POINT Z EMPTY
+15400|POINT Z EMPTY
+16500|POINT Z EMPTY
+17600|POINT Z EMPTY
+18700|POINT Z EMPTY
+19800|POINT Z EMPTY
scan_seq|Seq Scan
+1100|POINT Z EMPTY
1250|POINT Z (125 125 125)
1251|POINT Z (125.1 125.1 125.1)
1252|POINT Z (125.2 125.2 125.2)
@@ -34,6 +52,22 @@ scan_seq|Seq Scan
1258|POINT Z (125.8 125.8 125.8)
1259|POINT Z (125.9 125.9 125.9)
1260|POINT Z (126 126 126)
+2200|POINT Z EMPTY
+3300|POINT Z EMPTY
+4400|POINT Z EMPTY
+5500|POINT Z EMPTY
+6600|POINT Z EMPTY
+7700|POINT Z EMPTY
+8800|POINT Z EMPTY
+9900|POINT Z EMPTY
+12100|POINT Z EMPTY
+13200|POINT Z EMPTY
+14300|POINT Z EMPTY
+15400|POINT Z EMPTY
+16500|POINT Z EMPTY
+17600|POINT Z EMPTY
+18700|POINT Z EMPTY
+19800|POINT Z EMPTY
scan_seq|Seq Scan
20
scan_idx|Bitmap Heap Scan,Bitmap Index Scan
@@ -49,6 +83,7 @@ scan_idx|Bitmap Heap Scan,Bitmap Index Scan
1259|POINT Z (125.9 125.9 125.9)
1260|POINT Z (126 126 126)
scan_idx|Bitmap Heap Scan,Bitmap Index Scan
+1100|POINT Z EMPTY
1250|POINT Z (125 125 125)
1251|POINT Z (125.1 125.1 125.1)
1252|POINT Z (125.2 125.2 125.2)
@@ -61,6 +96,7 @@ scan_idx|Bitmap Heap Scan,Bitmap Index Scan
1259|POINT Z (125.9 125.9 125.9)
1260|POINT Z (126 126 126)
scan_idx|Bitmap Heap Scan,Bitmap Index Scan
+1100|POINT Z EMPTY
1250|POINT Z (125 125 125)
1251|POINT Z (125.1 125.1 125.1)
1252|POINT Z (125.2 125.2 125.2)
-----------------------------------------------------------------------
Summary of changes:
postgis/gserialized_gist_2d.c | 25 +++++++++++++++++---
regress/core/regress_brin_index_3d_expected | 36 +++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 3 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list