[postgis-tickets] [SCM] PostGIS branch master updated. 3.2.0beta1-30-gb24d7125a

git at osgeo.org git at osgeo.org
Thu Nov 25 02:02:46 PST 2021


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  b24d7125a3b9de291bcc46d6d92721a66702f71c (commit)
       via  f523c156430076330ba62ec11f65fee195a184b0 (commit)
       via  10d9f092f728d573cf7092e1a5c2cf04e901f915 (commit)
      from  352fe49e965aed08819d7088df9d370714c1f5ec (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 b24d7125a3b9de291bcc46d6d92721a66702f71c
Author: Björn Harrtell <bjorn at wololo.org>
Date:   Thu Nov 25 10:22:18 2021 +0100

    Also construct and check with correct table structure

diff --git a/regress/core/flatgeobuf.sql b/regress/core/flatgeobuf.sql
index 7c26e93aa..15df3aaab 100644
--- a/regress/core/flatgeobuf.sql
+++ b/regress/core/flatgeobuf.sql
@@ -134,10 +134,21 @@ select 'A1', id, ST_AsText(geom), bool_1, int_1, int_2, smallint_1, bigint_1, fl
 );
 
 select '--- Exotic roundtrips ---';
--- 2D Point not first geometry
-select 'E1', id, ST_AsText(geom) from ST_FromFlatGeobuf(null::flatgeobuf_t1, (
-    select ST_AsFlatGeobuf(q) fgb from (select true::boolean as bool_1, ST_MakePoint(1.1, 2.1)) q)
+
+-- 2D Point geometry at column index 2
+select ST_TableFromFlatGeobuf('public', 'flatgeobuf_e1', (select ST_AsFlatGeobuf(q) fgb from (select
+        true::boolean as bool_1,
+        ST_MakePoint(1.1, 2.1),
+        false::boolean as bool_2
+    ) q));
+select 'E1', id, bool_1, ST_AsText(geom), bool_2 from ST_FromFlatGeobuf(null::flatgeobuf_e1, (
+    select ST_AsFlatGeobuf(q) fgb from (select
+        true::boolean as bool_1,
+        ST_MakePoint(1.1, 2.1),
+        false::boolean as bool_2
+    ) q)
 );
 
 drop table if exists public.flatgeobuf_t1;
 drop table if exists public.flatgeobuf_a1;
+drop table if exists public.flatgeobuf_e1;
diff --git a/regress/core/flatgeobuf_expected b/regress/core/flatgeobuf_expected
index b95cd5f31..bb17110b6 100644
--- a/regress/core/flatgeobuf_expected
+++ b/regress/core/flatgeobuf_expected
@@ -22,4 +22,4 @@ P1|1|POINT(3 4)
 --- Attribute roundtrips ---
 A1|0||t|1|2|3|4|1.2|1.3|2016-06-23 03:44:52.134125+00|hello
 --- Exotic roundtrips ---
-E1|0|POINT(1.1 2.1)
+E1|0|t|POINT(1.1 2.1)|f

commit f523c156430076330ba62ec11f65fee195a184b0
Author: Björn Harrtell <bjorn at wololo.org>
Date:   Thu Nov 25 10:14:51 2021 +0100

    Fix inspect/encode order issue

diff --git a/postgis/flatgeobuf.c b/postgis/flatgeobuf.c
index 7704cdbf7..566e6cdca 100644
--- a/postgis/flatgeobuf.c
+++ b/postgis/flatgeobuf.c
@@ -66,7 +66,7 @@ static uint8_t get_column_type(Oid typoid) {
 		typoid);
 }
 
-static void encode_header(struct flatgeobuf_agg_ctx *ctx)
+static void inspect_table(struct flatgeobuf_agg_ctx *ctx)
 {
 	flatgeobuf_column *c;
 	flatgeobuf_column **columns;
@@ -77,7 +77,7 @@ static void encode_header(struct flatgeobuf_agg_ctx *ctx)
 	int natts = tupdesc->natts;
 	bool geom_found = false;
 
-	POSTGIS_DEBUG(2, "calling encode_header");
+	POSTGIS_DEBUG(2, "calling inspect_table");
 
 	columns = palloc(sizeof(flatgeobuf_column *) * natts);
 	ctx->tupdesc = tupdesc;
@@ -91,13 +91,13 @@ static void encode_header(struct flatgeobuf_agg_ctx *ctx)
 		if (ctx->geom_name == NULL) {
 			if (!geom_found && typoid == postgis_oid(GEOMETRYOID)) {
 				ctx->geom_index = i;
-				geom_found = 1;
+				geom_found = true;
 				continue;
 			}
 		} else {
 			if (!geom_found && strcmp(key, ctx->geom_name) == 0) {
 				ctx->geom_index = i;
-				geom_found = 1;
+				geom_found = true;
 				continue;
 			}
 		}
@@ -114,8 +114,6 @@ static void encode_header(struct flatgeobuf_agg_ctx *ctx)
 		ctx->ctx->columns = columns;
 		ctx->ctx->columns_size = columns_size;
 	}
-
-	flatgeobuf_encode_header(ctx->ctx);
 }
 
 // ensure properties has room for at least size
@@ -522,16 +520,18 @@ void flatgeobuf_agg_transfn(struct flatgeobuf_agg_ctx *ctx)
 	Datum datum;
 	GSERIALIZED *gs;
 
+	if (ctx->ctx->features_count == 0)
+		inspect_table(ctx);
+
 	datum = GetAttributeByNum(ctx->row, ctx->geom_index + 1, &isnull);
 	if (!isnull) {
 		gs = (GSERIALIZED *) PG_DETOAST_DATUM_COPY(datum);
 		lwgeom = lwgeom_from_gserialized(gs);
 	}
-
 	ctx->ctx->lwgeom = lwgeom;
 
 	if (ctx->ctx->features_count == 0)
-		encode_header(ctx);
+		flatgeobuf_encode_header(ctx->ctx);
 
 	encode_properties(ctx);
 	if (ctx->ctx->create_index)
@@ -551,9 +551,8 @@ uint8_t *flatgeobuf_agg_finalfn(struct flatgeobuf_agg_ctx *ctx)
 		flatgeobuf_agg_ctx_init(NULL, false);
 	// header only result
 	if (ctx->ctx->features_count == 0) {
-		encode_header(ctx);
-	}
-	else if (ctx->ctx->create_index) {
+		flatgeobuf_encode_header(ctx->ctx);
+	} else if (ctx->ctx->create_index) {
 		ctx->ctx->index_node_size = 16;
 		flatgeobuf_create_index(ctx->ctx);
 	}

commit 10d9f092f728d573cf7092e1a5c2cf04e901f915
Author: Björn Harrtell <bjorn at wololo.org>
Date:   Thu Nov 25 09:57:42 2021 +0100

    Add reproduction test

diff --git a/regress/core/flatgeobuf.sql b/regress/core/flatgeobuf.sql
index e324f8080..7c26e93aa 100644
--- a/regress/core/flatgeobuf.sql
+++ b/regress/core/flatgeobuf.sql
@@ -133,5 +133,11 @@ select 'A1', id, ST_AsText(geom), bool_1, int_1, int_2, smallint_1, bigint_1, fl
     ) q)
 );
 
+select '--- Exotic roundtrips ---';
+-- 2D Point not first geometry
+select 'E1', id, ST_AsText(geom) from ST_FromFlatGeobuf(null::flatgeobuf_t1, (
+    select ST_AsFlatGeobuf(q) fgb from (select true::boolean as bool_1, ST_MakePoint(1.1, 2.1)) q)
+);
+
 drop table if exists public.flatgeobuf_t1;
 drop table if exists public.flatgeobuf_a1;
diff --git a/regress/core/flatgeobuf_expected b/regress/core/flatgeobuf_expected
index 4d1b4b375..b95cd5f31 100644
--- a/regress/core/flatgeobuf_expected
+++ b/regress/core/flatgeobuf_expected
@@ -21,3 +21,5 @@ P1|0|POINT(1 2)
 P1|1|POINT(3 4)
 --- Attribute roundtrips ---
 A1|0||t|1|2|3|4|1.2|1.3|2016-06-23 03:44:52.134125+00|hello
+--- Exotic roundtrips ---
+E1|0|POINT(1.1 2.1)

-----------------------------------------------------------------------

Summary of changes:
 postgis/flatgeobuf.c             | 21 ++++++++++-----------
 regress/core/flatgeobuf.sql      | 17 +++++++++++++++++
 regress/core/flatgeobuf_expected |  2 ++
 3 files changed, 29 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list