[postgis-tickets] r15630 - Support PgSQL 10 on PostGIS 2.3
Paul Ramsey
pramsey at cleverelephant.ca
Tue Sep 5 13:37:59 PDT 2017
Author: pramsey
Date: 2017-09-05 13:37:59 -0700 (Tue, 05 Sep 2017)
New Revision: 15630
Modified:
branches/2.3/configure.ac
branches/2.3/libpgcommon/gserialized_gist.c
branches/2.3/postgis/gserialized_estimate.c
branches/2.3/postgis/gserialized_gist_nd.c
branches/2.3/raster/rt_pg/rtpostgis.sql.in
branches/2.3/raster/test/regress/rt_union.sql
branches/2.3/raster/test/regress/rt_union_expected
branches/2.3/regress/regress_selectivity.sql
branches/2.3/topology/sql/topogeometry/totopogeom.sql.in
branches/2.3/topology/test/regress/copytopology.sql
branches/2.3/topology/test/regress/copytopology_expected
Log:
Support PgSQL 10 on PostGIS 2.3
Modified: branches/2.3/configure.ac
===================================================================
--- branches/2.3/configure.ac 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/configure.ac 2017-09-05 20:37:59 UTC (rev 15630)
@@ -433,6 +433,15 @@
PGSQL_MAJOR_VERSION=`echo $PGSQL_FULL_VERSION | sed 's/[[^0-9]]*\([[0-9]]*\).*/\1/'`
PGSQL_MINOR_VERSION=`echo $PGSQL_FULL_VERSION | sed 's/[[^\.]]*\.\([[0-9]]*\).*/\1/'`
PGSQL_MINOR_VERSION=`echo $PGSQL_MINOR_VERSION | sed 's/.*devel.*/0/'`
+
+ if test $PGSQL_MAJOR_VERSION -gt 9; then
+ dnl ==================================================================
+ dnl Starting with PostgreSQL 10, major is the new minor
+ dnl This is to prevent things like 10.31 ranking higher than 11.0
+ dnl===================================================================
+ PGSQL_MINOR_VERSION=0
+ fi
+
POSTGIS_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"
PGSQL_PKGLIBDIR=`$PG_CONFIG --pkglibdir`
Modified: branches/2.3/libpgcommon/gserialized_gist.c
===================================================================
--- branches/2.3/libpgcommon/gserialized_gist.c 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/libpgcommon/gserialized_gist.c 2017-09-05 20:37:59 UTC (rev 15630)
@@ -22,6 +22,10 @@
#include "lwgeom_pg.h" /* For debugging macros. */
#include "gserialized_gist.h"
+#if POSTGIS_PGSQL_VERSION >= 100
+#include <float.h>
+#endif
+
#define FLAGS_NDIMS_GIDX(f) ( FLAGS_GET_GEODETIC(f) ? 3 : \
FLAGS_GET_M(f) ? 4 : \
FLAGS_GET_Z(f) ? 3 : 2 )
Modified: branches/2.3/postgis/gserialized_estimate.c
===================================================================
--- branches/2.3/postgis/gserialized_estimate.c 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/postgis/gserialized_estimate.c 2017-09-05 20:37:59 UTC (rev 15630)
@@ -827,31 +827,52 @@
static ND_STATS*
pg_nd_stats_from_tuple(HeapTuple stats_tuple, int mode)
{
- int stats_kind = STATISTIC_KIND_ND;
- int rv, nvalues;
- float4 *floatptr;
+ int stats_kind = STATISTIC_KIND_ND;
+ int rv;
ND_STATS *nd_stats;
- /* If we're in 2D mode, set the kind appropriately */
- if ( mode == 2 ) stats_kind = STATISTIC_KIND_2D;
+ /* If we're in 2D mode, set the kind appropriately */
+ if ( mode == 2 ) stats_kind = STATISTIC_KIND_2D;
- /* Then read the geom status histogram from that */
- rv = get_attstatsslot(stats_tuple, 0, 0, stats_kind, InvalidOid,
- NULL, NULL, NULL, &floatptr, &nvalues);
- if ( ! rv ) {
- POSTGIS_DEBUGF(2,
- "no slot of kind %d in stats tuple", stats_kind);
- return NULL;
- }
+ /* Then read the geom status histogram from that */
+
+#if POSTGIS_PGSQL_VERSION < 100
+ float4 *floatptr;
+ int nvalues;
- /* Clone the stats here so we can release the attstatsslot immediately */
- nd_stats = palloc(sizeof(float) * nvalues);
- memcpy(nd_stats, floatptr, sizeof(float) * nvalues);
+ rv = get_attstatsslot(stats_tuple, 0, 0, stats_kind, InvalidOid,
+ NULL, NULL, NULL, &floatptr, &nvalues);
+
+ if ( ! rv ) {
+ POSTGIS_DEBUGF(2,
+ "no slot of kind %d in stats tuple", stats_kind);
+ return NULL;
+ }
+
+ /* Clone the stats here so we can release the attstatsslot immediately */
+ nd_stats = palloc(sizeof(float) * nvalues);
+ memcpy(nd_stats, floatptr, sizeof(float) * nvalues);
+
+ /* Clean up */
+ free_attstatsslot(0, NULL, 0, floatptr, nvalues);
+#else /* PostgreSQL 10 or higher */
+ AttStatsSlot sslot;
+ rv = get_attstatsslot(&sslot, stats_tuple, stats_kind, InvalidOid,
+ ATTSTATSSLOT_NUMBERS);
+ if ( ! rv ) {
+ POSTGIS_DEBUGF(2,
+ "no slot of kind %d in stats tuple", stats_kind);
+ return NULL;
+ }
+
+ /* Clone the stats here so we can release the attstatsslot immediately */
+ nd_stats = palloc(sizeof(float4) * sslot.nnumbers);
+ memcpy(nd_stats, sslot.numbers, sizeof(float4) * sslot.nnumbers);
+
+ free_attstatsslot(&sslot);
+#endif
- /* Clean up */
- free_attstatsslot(0, NULL, 0, floatptr, nvalues);
-
- return nd_stats;
+ return nd_stats;
}
/**
Modified: branches/2.3/postgis/gserialized_gist_nd.c
===================================================================
--- branches/2.3/postgis/gserialized_gist_nd.c 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/postgis/gserialized_gist_nd.c 2017-09-05 20:37:59 UTC (rev 15630)
@@ -52,6 +52,9 @@
#include <assert.h>
+#if POSTGIS_PGSQL_VERSION >= 100
+#include <float.h>
+#endif
/* Fall back to older finite() if necessary */
#ifndef HAVE_ISFINITE
Modified: branches/2.3/raster/rt_pg/rtpostgis.sql.in
===================================================================
--- branches/2.3/raster/rt_pg/rtpostgis.sql.in 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/raster/rt_pg/rtpostgis.sql.in 2017-09-05 20:37:59 UTC (rev 15630)
@@ -7037,7 +7037,7 @@
SELECT
CASE
WHEN strpos(s.consrc, 'ANY (ARRAY[') > 0 THEN
- split_part((regexp_matches(s.consrc, E'ARRAY\\[(.*?){1}\\]'))[1], ',', 1)::integer
+ split_part((substring(s.consrc FROM E'ARRAY\\[(.*?){1}\\]')), ',', 1)::integer
ELSE
regexp_replace(
split_part(s.consrc, '= ', 2),
Modified: branches/2.3/raster/test/regress/rt_union.sql
===================================================================
--- branches/2.3/raster/test/regress/rt_union.sql 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/raster/test/regress/rt_union.sql 2017-09-05 20:37:59 UTC (rev 15630)
@@ -143,13 +143,13 @@
SELECT
uniontype,
- x,
- y,
- val
+ (pp).x,
+ (pp).y,
+ (pp).val
FROM (
SELECT
uniontype,
- (ST_PixelAsPoints(rast)).*
+ (ST_PixelAsPoints(rast)) AS pp
FROM raster_union_out
) foo
ORDER BY uniontype, y, x;
Modified: branches/2.3/raster/test/regress/rt_union_expected
===================================================================
--- branches/2.3/raster/test/regress/rt_union_expected 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/raster/test/regress/rt_union_expected 2017-09-05 20:37:59 UTC (rev 15630)
@@ -53,9 +53,6 @@
SUM|2|3|2
SUM|3|3|2
NOTICE: No pixels found for band 1
-NOTICE: No pixels found for band 1
-NOTICE: No pixels found for band 1
-NOTICE: No pixels found for band 1
COUNT|1|1|1
COUNT|2|1|1
COUNT|3|1|1
Modified: branches/2.3/regress/regress_selectivity.sql
===================================================================
--- branches/2.3/regress/regress_selectivity.sql 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/regress/regress_selectivity.sql 2017-09-05 20:37:59 UTC (rev 15630)
@@ -1,4 +1,2141 @@
+-- Make example data
+CREATE TABLE regular_overdots_ab (
+ a integer,
+ b integer
+);
+
+COPY regular_overdots_ab (a, b) FROM stdin;
+1 1
+1 1
+1 2
+1 1
+1 2
+1 3
+1 1
+1 2
+1 3
+1 4
+1 1
+1 2
+1 3
+1 4
+1 5
+1 1
+1 2
+1 3
+1 4
+1 5
+1 6
+1 1
+1 2
+1 3
+1 4
+1 5
+1 6
+1 7
+1 1
+1 2
+1 3
+1 4
+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4 9
+5 1
+6 2
+7 3
+8 4
+9 5
+10 6
+1 7
+2 8
+3 9
+4 1
+5 2
+6 3
+7 4
+8 5
+9 6
+10 7
+1 8
+2 9
+3 1
+4 2
+5 3
+6 4
+7 5
+8 6
+9 7
+10 8
+1 9
+2 1
+3 2
+4 3
+5 4
+6 5
+7 6
+8 7
+9 8
+10 9
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+\.
+
+
-- Check for error messages
create table no_stats ( g geometry, id integer );
create table no_stats_join ( g geometry, id integer );
@@ -8,15 +2145,12 @@
insert into no_stats (g, id) values ('POINT(0 0)', 0);
analyze no_stats;
select _postgis_join_selectivity('no_stats', 'g', 'no_stats_join', 'g');
-drop table no_stats;
-drop table no_stats_join;
+drop table if exists no_stats;
+drop table if exists no_stats_join;
-- Table with uniformly variable density, highest at 1,1, lowest at 10,10
create table regular_overdots as
-with
-ij as ( select i, j from generate_series(1, 10) i, generate_series(1, 10) j),
-iijj as (select generate_series(1, i) as a, generate_series(1, j) b from ij)
-select st_makepoint(a, b) as g from iijj;
+ select st_makepoint(a, b) as g from regular_overdots_ab;
-- Generate the stats
analyze regular_overdots;
@@ -49,4 +2183,5 @@
-- Clean
drop table if exists regular_overdots;
+drop table if exists regular_overdots_ab;
Modified: branches/2.3/topology/sql/topogeometry/totopogeom.sql.in
===================================================================
--- branches/2.3/topology/sql/topogeometry/totopogeom.sql.in 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/topology/sql/topogeometry/totopogeom.sql.in 2017-09-05 20:37:59 UTC (rev 15630)
@@ -139,6 +139,7 @@
tolerance FLOAT8;
alayer INT;
atopology TEXT;
+ var_dims integer;
BEGIN
#ifdef POSTGIS_TOPOLOGY_DEBUG
@@ -230,23 +231,31 @@
'Unexpected feature dimension %', ST_Dimension(ageom);
END IF;
+
-- Now that we have an empty topogeometry, we loop over distinct components
-- and add them to the definition of it. We add them as soon
-- as possible so that each element can further edit the
-- definition by splitting
FOR rec IN SELECT id(tg), alayer as lyr,
- geom, ST_Dimension(geom) as dims
- FROM (SELECT (ST_Dump(ageom)).geom) as f
- WHERE NOT ST_IsEmpty(geom)
+ geom, ST_Dimension(gd.geom) as dims
+ FROM ST_Dump(ageom) AS gd
+ WHERE NOT ST_IsEmpty(gd.geom)
LOOP
- FOR rec2 IN SELECT CASE
- WHEN rec.dims = 0 THEN
- topology.topogeo_addPoint(atopology, rec.geom, tolerance)
- WHEN rec.dims = 1 THEN
- topology.topogeo_addLineString(atopology, rec.geom, tolerance)
- WHEN rec.dims = 2 THEN
- topology.topogeo_addPolygon(atopology, rec.geom, tolerance)
- END as primitive
+ -- NOTE: Switched from using case to this because of PG 10 behavior change
+ -- Using a UNION ALL only one will be processed because of the WHERE
+ -- Since the WHERE clause will be processed first
+ FOR rec2 IN SELECT primitive
+ FROM
+ (
+ SELECT topology.topogeo_addPoint(atopology, rec.geom, tolerance)
+ WHERE rec.dims = 0
+ UNION ALL
+ SELECT topology.topogeo_addLineString(atopology, rec.geom, tolerance)
+ WHERE rec.dims = 1
+ UNION ALL
+ SELECT topology.topogeo_addPolygon(atopology, rec.geom, tolerance)
+ WHERE rec.dims = 2
+ ) AS f(primitive)
LOOP
elem := ARRAY[rec.dims+1, rec2.primitive]::text;
IF elems @> ARRAY[elem] THEN
Modified: branches/2.3/topology/test/regress/copytopology.sql
===================================================================
--- branches/2.3/topology/test/regress/copytopology.sql 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/topology/test/regress/copytopology.sql 2017-09-05 20:37:59 UTC (rev 15630)
@@ -39,13 +39,13 @@
ORDER BY l.layer_id;
-- Check sequences
-SELECT * from "CITY_data_UP_down".node_node_id_seq;
-SELECT * from "CITY_data_UP_down".edge_data_edge_id_seq;
-SELECT * from "CITY_data_UP_down".face_face_id_seq;
-SELECT sequence_name, last_value, start_value, increment_by, max_value, min_value, cache_value, is_cycled, is_called from "CITY_data_UP_down".layer_id_seq;
-SELECT * from "CITY_data_UP_down".topogeo_s_1;
-SELECT * from "CITY_data_UP_down".topogeo_s_2;
-SELECT * from "CITY_data_UP_down".topogeo_s_3;
+SELECT tableoid::regclass AS sequence_name, last_value, is_called from "CITY_data_UP_down".node_node_id_seq;
+SELECT tableoid::regclass AS sequence_name, last_value, is_called from "CITY_data_UP_down".edge_data_edge_id_seq;
+SELECT tableoid::regclass AS sequence_name, last_value, is_called from "CITY_data_UP_down".face_face_id_seq;
+SELECT tableoid::regclass AS sequence_name, last_value, is_called from "CITY_data_UP_down".layer_id_seq;
+SELECT tableoid::regclass AS sequence_name, last_value, is_called from "CITY_data_UP_down".topogeo_s_1;
+SELECT tableoid::regclass AS sequence_name, last_value, is_called from "CITY_data_UP_down".topogeo_s_2;
+SELECT tableoid::regclass AS sequence_name, last_value, is_called from "CITY_data_UP_down".topogeo_s_3;
SELECT topology.DropTopology('CITY_data_UP_down');
SELECT topology.DropTopology('city_data');
Modified: branches/2.3/topology/test/regress/copytopology_expected
===================================================================
--- branches/2.3/topology/test/regress/copytopology_expected 2017-09-05 20:33:24 UTC (rev 15629)
+++ branches/2.3/topology/test/regress/copytopology_expected 2017-09-05 20:37:59 UTC (rev 15630)
@@ -19,13 +19,13 @@
1|CITY_data_UP_down|LAYER1|
2|CITY_data_UP_down|LAYER2|
3|CITY_data_UP_down|LAYER3|
-node_node_id_seq|22|1|1|9223372036854775807|1|1|0|f|t
-edge_data_edge_id_seq|26|1|1|9223372036854775807|1|1|0|f|t
-face_face_id_seq|9|1|1|9223372036854775807|1|1|0|f|t
-layer_id_seq|1|1|1|9223372036854775807|1|1|f|f
-topogeo_s_1|9|1|1|9223372036854775807|1|1|0|f|t
-topogeo_s_2|8|1|1|9223372036854775807|1|1|0|f|t
-topogeo_s_3|8|1|1|9223372036854775807|1|1|0|f|t
+"CITY_data_UP_down".node_node_id_seq|22|t
+"CITY_data_UP_down".edge_data_edge_id_seq|26|t
+"CITY_data_UP_down".face_face_id_seq|9|t
+"CITY_data_UP_down".layer_id_seq|1|f
+"CITY_data_UP_down".topogeo_s_1|9|t
+"CITY_data_UP_down".topogeo_s_2|8|t
+"CITY_data_UP_down".topogeo_s_3|8|t
Topology 'CITY_data_UP_down' dropped
Topology 'city_data' dropped
#2184.1|t
More information about the postgis-tickets
mailing list