Commit 049887b6 authored by Bas Couwenberg's avatar Bas Couwenberg

Imported Upstream version 2.3.2+dfsg

parent 0844205f
2017-01-28 04:10 Regina Obe <lr@pcorp.us>
* [r15295] liblwgeom/lwprint.c: Fix for 32-bit lwprint to support
ST_AsLatLonText
References #3688 for PostGIS 2.3.2
2017-01-25 23:42 Regina Obe <lr@pcorp.us>
* [r15293] extras/tiger_geocoder/tiger_loader_2016.sql: Turn off
loading of tabblock by default. It's been broken since 2014
References #3898 for PostGIS 2.3
2017-01-22 07:44 Regina Obe <lr@pcorp.us>
* [r15291] postgis/geography.sql.in, postgis/geography_brin.sql.in,
postgis/postgis.sql.in, postgis/postgis_brin.sql.in: Fix for
pg_upgrade of pg < 9.5 + 2.3+, pg_upgrade and doing a postgis
micro update to latest stable.
closes #3683 for PostGIS 2.3
2017-01-18 21:07 Sandro Santilli <strk@kbt.io>
* [r15289] NEWS, liblwgeom/cunit/cu_print.c, liblwgeom/lwprint.c:
ST_AsLatLonText: round minutes [2.3 backport]
Patch by Mike Toews, closes #3688
2017-01-07 08:52 Regina Obe <lr@pcorp.us>
* [r15285] NEWS, postgis/gserialized_gist_2d.c,
regress/knn_recheck.sql, regress/knn_recheck_expected: KNN
recheck in 9.5+ fails with index returned tuples in wrong order
references #3418 for PostGIS 2.3
2017-01-06 10:31 Regina Obe <lr@pcorp.us>
* [r15282] NEWS: update news with latest 2 bug fixes
2017-01-05 19:15 Regina Obe <lr@pcorp.us>
* [r15280] postgis/postgis.sql.in: Relationship functions not using
an index in some cases
Set cost back to 1 for functions that return a geometry
A higher cost has the side-effect of making the planner
think when used in conjunction with relate constructs like
ST_Intersects
it's cheaper to compute the geometry once rather
than compute twice and break into an index and non-index call.
References #3657 for PostGIS 2.3
2016-12-20 03:22 Regina Obe <lr@pcorp.us>
* [r15278] utils/postgis_proc_upgrade.pl: PostGIS upgrade scripts
missing GRANT for views
references #3680 for PostGIS 2.3
2016-12-03 22:32 Sandro Santilli <strk@kbt.io>
* [r15270] NEWS: Indent and style NEWS file
2016-12-03 20:39 Regina Obe <lr@pcorp.us>
* [r15268] postgis/postgis.sql.in: Cost on ST_SetSRID is preventing
index use with relation functions. Change from 10 to 1.
References #3675 for PostGIS 2.3
2016-11-28 15:10 Regina Obe <lr@pcorp.us>
* [r15265] HOWTO_RELEASE, Version.config,
extensions/upgradeable_versions.mk: More minor corrections to
HOW_TO_RELEASE, bump version to 2.3.2dev
2016-11-28 14:49 Regina Obe <lr@pcorp.us>
* [r15263] ChangeLog, HOWTO_RELEASE, NEWS, README.postgis,
Version.config, doc/release_notes.xml,
extensions/upgradeable_versions.mk: More corrections to
HOWTO_RELEASE, prepare for PostGIS 2.3.1 release
2016-11-26 21:49 Regina Obe <lr@pcorp.us>
* [r15260] HOWTO_RELEASE: Add build badges, trunk vs. branch
PostGIS 2.3.2
2017/01/31
* Bug Fixes
- #3418, KNN recheck in 9.5+ fails with index returned tuples in wrong order
- #3675, Relationship functions not using an index in some cases
- #3680, PostGIS upgrade scripts missing GRANT for views
- #3683, Unable to update postgis after postgres pg_upgrade going from < 9.5 to pg > 9.4
- #3688, ST_AsLatLonText: round minutes
PostGIS 2.3.1
2016/11/28
* Bug Fixes
- #1973, st_concavehull() returns sometimes empty geometry collection
Fix from gde
(gde)
- #3501, add raster constraint max extent exceeds array size limit
for large tables
for large tables
- #3643, PostGIS not building on latest OSX XCode
- #3644, Deadlock on interrupt
- #3650, Mark ST_Extent, ST_3DExtent and ST_Mem*
agg functions as parallel safe so they can be parallelized
- #3650, Mark ST_Extent, ST_3DExtent and ST_Mem*
agg functions as parallel safe so they can be parallelized
- #3652, Crash on Collection(MultiCurve())
- #3656, Fix upgrade of aggregates from 2.2 or lower version
- #3659, Crash caused by raster GUC define after CREATE EXTENSION
using wrong memory context. (manaeem)
using wrong memory context. (manaeem)
- #3665, Index corruption and memory leak in BRIN indexes
patch from Julien Rouhaud (Dalibo)
(Julien Rouhaud of Dalibo)
- #3667, geography ST_Segmentize bug
patch from Hugo Mercier (Oslandia)
(Hugo Mercier of Oslandia)
PostGIS 2.3.0
2016/09/26
......@@ -33,8 +45,6 @@ PostGIS 2.3.0
- #3396, ST_EstimatedExtent, throw WARNING instead of ERROR
(Regina Obe)
* Deprecated signatures *
* New Features *
- Add support for custom TOC in postgis_restore.pl
......@@ -76,7 +86,9 @@ PostGIS 2.3.0
(Hugo Mercier of Oslandia)
* Bug Fixes
- #2841, ST_MinimumBoundingCircle not covering original
- #2841, ST_MinimumBoundingCircle not covering original
* Performance Enhancements *
- #75, Enhancement to PIP short circuit (Dan Baston)
......@@ -86,10 +98,6 @@ PostGIS 2.3.0
- Make adding a line to topology interruptible (Sandro Santilli)
- Documentation updates from Mike Toews
PostGIS 2.3.0beta1
2016/09/06
See PostGIS 2.3.0 section for details
PostGIS 2.2.2
2016/03/22
......
PostGIS - Geographic Information Systems Extensions to PostgreSQL
=================================================================
:Version: 2.3.1
:Date: 2016-11-28
:Version: 2.3.2
:Date: 2017-01-30
:Website: http://postgis.net
This distribution contains a module which implements GIS simple features, ties
......@@ -187,7 +187,8 @@ UPGRADING EXISTING SPATIAL DATABASES
Upgrade PostGIS using the "ALTER EXTENSION" facility.
ALTER EXTENSION postgis UPDATE TO '2.2.0';
ALTER EXTENSION postgis UPDATE;
USAGE
......
......@@ -5,7 +5,7 @@
POSTGIS_MAJOR_VERSION=2
POSTGIS_MINOR_VERSION=3
POSTGIS_MICRO_VERSION=1
POSTGIS_MICRO_VERSION=2
# Liblwgeom interface versioning, reset to 0:0:0 (cur:age:rev)
# when changing POSTGIS_MINOR_VERSION
......
......@@ -2,6 +2,20 @@
<appendix id="release_notes">
<title>Appendix</title>
<subtitle>Release Notes</subtitle>
<sect1>
<title>Release 2.3.2</title>
<para>Release date: 2017/01/31</para>
<para>This is a bug fix and performance improvement release.</para>
<simplesect>
<title>Bug Fixes and Enhancements</title>
<para>#3418, KNN recheck in 9.5+ fails with index returned tuples in wrong order</para>
<para>#3675, Relationship functions not using an index in some cases</para>
<para>#3680, PostGIS upgrade scripts missing GRANT for views</para>
<para>#3683, Unable to update postgis after postgres pg_upgrade going from &lt; 9.5 to pg &gt; 9.4</para>
<para>#3688, ST_AsLatLonText: round minutes</para>
</simplesect>
</sect1>
<sect1>
<title>Release 2.3.1</title>
<para>Release date: 2016/11/28</para>
......
......@@ -30,14 +30,14 @@ POSTGIS_PGSQL_VERSION=96
SQLPP = /usr/bin/cpp -traditional-cpp -w -P
GREP=/bin/grep
PERL=/usr/bin/perl
EXTVERSION = 2.3.1
EXTVERSION = 2.3.2
MINORVERSION = 2.3
MODULE_big = address_standardizer-2.3
EXTENSION = address_standardizer
DATA = address_standardizer_data_us.control sql/$(EXTENSION).sql sql/$(EXTENSION)_data_us.sql
all: sql/address_standardizer.sql sql/address_standardizer--1.0--$(EXTVERSION).sql sql/address_standardizer--$(EXTVERSION).sql sql/address_standardizer--$(EXTVERSION)--$(EXTVERSION)next.sql sql/address_standardizer--$(EXTVERSION)next--$(EXTVERSION).sql \
sql/$(EXTENSION)_data_us.sql sql/address_standardizer--2.3.1.sql sql/$(EXTENSION)_data_us--2.3.1.sql sql/$(EXTENSION)_data_us--$(EXTVERSION)--$(EXTVERSION)next.sql \
sql/$(EXTENSION)_data_us.sql sql/address_standardizer--2.3.2.sql sql/$(EXTENSION)_data_us--2.3.2.sql sql/$(EXTENSION)_data_us--$(EXTVERSION)--$(EXTVERSION)next.sql \
sql/$(EXTENSION)_data_us--$(EXTVERSION)next--$(EXTVERSION).sql \
sql/test-init-extensions.sql sql/test-parseaddress.sql sql/test-standardize_address_1.sql sql/test-standardize_address_2.sql
......@@ -46,9 +46,9 @@ EXTRA_CLEAN += sql/*.sql
DOCS = README.address_standardizer
PG_CPPFLAGS = -I/var/lib/jenkins/workspace/geos/rel-3.6.1devw64/include -I/usr/include/libxml2 -I/usr/include -DHAVE_SFCGAL -I/var/lib/jenkins/workspace/pg/rel/pg9.6w64/pg9.6/include -g -O0
PG_CPPFLAGS = -I/var/lib/jenkins/workspace/geos/rel-3.7.0devw64/include -I/usr/include/libxml2 -I/usr/include -DHAVE_SFCGAL -I/var/lib/jenkins/workspace/pg/rel/pg9.6w64/pg9.6/include -g -O0
SHLIB_LINK = -L/var/lib/jenkins/workspace/geos/rel-3.6.1devw64/lib -lgeos_c -lproj -ljson-c -lxml2 -L/usr/lib/x86_64-linux-gnu -lSFCGAL -Wl,--exclude-libs,ALL -lpcre
SHLIB_LINK = -L/var/lib/jenkins/workspace/geos/rel-3.7.0devw64/lib -lgeos_c -lproj -ljson-c -lxml2 -L/usr/lib/x86_64-linux-gnu -lSFCGAL -Wl,--exclude-libs,ALL -lpcre
EXTRA_CLEAN = usps-st-city-name.txt mk-st-regexp mk-city-regex test_main
REGRESS = test-init-extensions test-parseaddress test-standardize_address_1 test-standardize_address_2
......@@ -68,7 +68,7 @@ sql/%.sql: %.sql.in
$(SQLPP) -I../libpgcommon $< | grep -v '^#' | \
$(PERL) -lpe "s'MODULE_PATHNAME'\$$libdir/${EXTENSION}-${MINORVERSION}'g" > $@
sql/address_standardizer--2.3.1.sql: sql/address_standardizer_types.sql \
sql/address_standardizer--2.3.2.sql: sql/address_standardizer_types.sql \
sql/address_standardizer_functions.sql
cat $^ > $@
......
# address_standardizer extension
comment = 'Used to parse an address into constituent elements. Generally used to support geocoding address normalization step.'
default_version = '2.3.1'
default_version = '2.3.2'
relocatable = true
# address standardizer us dataset
comment = 'Address Standardizer US dataset example'
default_version = '2.3.1'
default_version = '2.3.2'
relocatable = true
include ../upgradeable_versions.mk
EXTENSION = postgis
EXTVERSION = 2.3.1
EXTVERSION = 2.3.2
MINORVERSION = 2.3
GREP = /bin/grep
PERL = /usr/bin/perl
......
# postgis extension
comment = 'PostGIS geometry, geography, and raster spatial types and functions'
default_version = '2.3.1'
default_version = '2.3.2'
module_pathname = '$libdir/postgis-2.3'
relocatable = false
include ../upgradeable_versions.mk
EXTENSION = postgis_sfcgal
EXTVERSION = 2.3.1
EXTVERSION = 2.3.2
MINORVERSION = 2.3
GREP = /bin/grep
PERL = /usr/bin/perl
......
# postgis topology extension
comment = 'PostGIS SFCGAL functions'
default_version = '2.3.1'
default_version = '2.3.2'
relocatable = true
requires = postgis
include ../upgradeable_versions.mk
EXTENSION = postgis_tiger_geocoder
EXTVERSION = 2.3.1
EXTVERSION = 2.3.2
MINORVERSION = 2011.2.3
GREP = /bin/grep
PERL = /usr/bin/perl
......
# postgis tiger geocoder extension
comment = 'PostGIS tiger geocoder and reverse geocoder'
default_version = '2.3.1'
default_version = '2.3.2'
relocatable = false
schema = tiger
requires = 'postgis,fuzzystrmatch'
include ../upgradeable_versions.mk
EXTENSION = postgis_topology
EXTVERSION = 2.3.1
EXTVERSION = 2.3.2
MINORVERSION = 2.3
GREP = /bin/grep
PERL = /usr/bin/perl
......
# postgis topology extension
comment = 'PostGIS topology spatial types and functions'
default_version = '2.3.1'
default_version = '2.3.2'
relocatable = false
schema = topology
requires = postgis
......@@ -22,7 +22,9 @@ UPGRADEABLE_VERSIONS = \
2.2.2 \
2.2.3 \
2.2.4 \
2.3.0
2.2.5 \
2.3.0 \
2.3.1
# This is to avoid forcing "check-installed-upgrades" as a default
# rule, see https://trac.osgeo.org/postgis/ticket/3420
......
......@@ -263,7 +263,7 @@ VALUES(10, 'tract', 'tract', true, false, true,false, 'c',
${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"', ARRAY['gid']);
INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
VALUES(11, 'tabblock', 'tabblock', true, false, true,false, 'c',
VALUES(11, 'tabblock', 'tabblock', false, false, true,false, 'c',
'${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (tabblock_id)) INHERITS(tiger.${lookup_name});" ',
'${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${lookup_name} RENAME geoid10 TO tabblock_id;"
${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
......
......@@ -80,6 +80,8 @@ static void test_lwprint_default_format(void)
test_lwprint_assert_format("POINT(-181 -91)", "" , "89\xC2\xB0""0'0.000\"S 1\xC2\xB0""0'0.000\"W");
test_lwprint_assert_format("POINT(-180.0001 -90.0001)", NULL, "89\xC2\xB0""59'59.640\"S 0\xC2\xB0""0'0.360\"W");
test_lwprint_assert_format("POINT(-2348982391.123456 -238749827.34879)", "" , "12\xC2\xB0""39'4.356\"N 31\xC2\xB0""7'24.442\"W");
/* See https://trac.osgeo.org/postgis/ticket/3688 */
test_lwprint_assert_format("POINT (76.6 -76.6)", NULL, "76\xC2\xB0""36'0.000\"S 76\xC2\xB0""36'0.000\"E");
}
/*
......
......@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "liblwgeom_internal.h"
/* Ensures the given lat and lon are in the "normal" range:
......@@ -105,6 +106,8 @@ static char * lwdouble_to_dms(double val, const char *pos_dir_symbol, const char
int sec_dec_digits = 0;
int sec_piece = -1;
int round_pow = 0;
int format_length = ((NULL == format) ? 0 : strlen(format));
char * result;
......@@ -312,8 +315,8 @@ static char * lwdouble_to_dms(double val, const char *pos_dir_symbol, const char
degrees = val;
if (min_digits > 0)
{
degrees = (long)degrees;
minutes = (val - degrees) * 60;
/* Break degrees to integer and use fraction for minutes */
minutes = modf(val, &degrees) * 60;
}
if (sec_digits > 0)
{
......@@ -321,8 +324,17 @@ static char * lwdouble_to_dms(double val, const char *pos_dir_symbol, const char
{
lwerror("Bad format, cannot include seconds (SS.SSS) without including minutes (MM.MMM).");
}
minutes = (long)minutes;
seconds = (val - (degrees + (minutes / 60))) * 3600;
seconds = modf(minutes, &minutes) * 60;
if (sec_piece >= 0)
{
/* See if the formatted seconds round up to 60. If so, increment minutes and reset seconds. */
round_pow = pow(10, sec_dec_digits);
if (floorf(seconds * round_pow) / round_pow >= 60)
{
minutes += 1;
seconds = 0;
}
}
}
/* Handle the compass direction. If not using compass dir, display degrees as a positive/negative number. */
......
......@@ -286,93 +286,8 @@ CREATE OPERATOR CLASS gist_geography_ops
FUNCTION 6 geography_gist_picksplit (internal, internal),
FUNCTION 7 geography_gist_same (box2d, box2d, internal);
#if POSTGIS_PGSQL_VERSION > 94
--------------------------------------------------------------------
-- BRIN support for geographies --
--------------------------------------------------------------------
--------------------------------
-- the needed cross-operators --
--------------------------------
-- Availability: 2.3.0
CREATE OR REPLACE FUNCTION overlaps_geog(gidx, geography)
RETURNS boolean
AS 'MODULE_PATHNAME','gserialized_gidx_geog_overlaps'
LANGUAGE 'c' IMMUTABLE STRICT;
-- Availability: 2.3.0
CREATE OR REPLACE FUNCTION overlaps_geog(gidx, gidx)
RETURNS boolean
AS 'MODULE_PATHNAME','gserialized_gidx_gidx_overlaps'
LANGUAGE 'c' IMMUTABLE STRICT;
-- Availability: 2.3.0
CREATE OPERATOR && (
LEFTARG = gidx,
RIGHTARG = geography,
PROCEDURE = overlaps_geog,
COMMUTATOR = &&
);
-- Availability: 2.3.0
CREATE OR REPLACE FUNCTION overlaps_geog(geography, gidx)
RETURNS boolean
AS $$
SELECT $2 OPERATOR(@extschema@.&&) $1;
$$ LANGUAGE SQL IMMUTABLE STRICT;
-- Availability: 2.3.0
CREATE OPERATOR && (
LEFTARG = geography,
RIGHTARG = gidx,
PROCEDURE = overlaps_geog,
COMMUTATOR = &&
);
-- Availability: 2.3.0
CREATE OPERATOR && (
LEFTARG = gidx,
RIGHTARG = gidx,
PROCEDURE = overlaps_geog,
COMMUTATOR = &&
);
--------------------------------
-- the OpFamily --
--------------------------------
-- Availability: 2.3.0
CREATE OPERATOR FAMILY brin_geography_inclusion_ops USING brin;
-- Availability: 2.3.0
CREATE OR REPLACE FUNCTION geog_brin_inclusion_add_value(internal, internal, internal, internal) RETURNS boolean
AS 'MODULE_PATHNAME','geog_brin_inclusion_add_value'
LANGUAGE 'c';
-- Availability: 2.3.0
CREATE OPERATOR CLASS brin_geography_inclusion_ops
DEFAULT FOR TYPE geography
USING brin
FAMILY brin_geography_inclusion_ops AS
OPERATOR 3 &&(geography, geography),
FUNCTION 1 brin_inclusion_opcinfo(internal) ,
FUNCTION 2 geog_brin_inclusion_add_value(internal, internal, internal, internal) ,
FUNCTION 3 brin_inclusion_consistent(internal, internal, internal) ,
FUNCTION 4 brin_inclusion_union(internal, internal, internal) ,
STORAGE gidx;
ALTER OPERATOR FAMILY brin_geography_inclusion_ops USING brin ADD
OPERATOR 3 &&(gidx, geography),
OPERATOR 3 &&(geography, gidx),
OPERATOR 3 &&(gidx, gidx);
---------------------------------------------------------------
-- END
---------------------------------------------------------------
#endif
-- moved to separate file cause its invovled
#include "geography_brin.sql.in"
-- ---------- ---------- ---------- ---------- ---------- ---------- ----------
-- B-Tree Functions
......
#if POSTGIS_PGSQL_VERSION > 94
--------------------------------------------------------------------
-- BRIN support for geographies --
--------------------------------------------------------------------
--------------------------------
-- the needed cross-operators --
--------------------------------
-- Availability: 2.3.0
CREATE OR REPLACE FUNCTION overlaps_geog(gidx, geography)
RETURNS boolean
AS 'MODULE_PATHNAME','gserialized_gidx_geog_overlaps'
LANGUAGE 'c' IMMUTABLE STRICT;
-- Availability: 2.3.0
CREATE OR REPLACE FUNCTION overlaps_geog(gidx, gidx)
RETURNS boolean
AS 'MODULE_PATHNAME','gserialized_gidx_gidx_overlaps'
LANGUAGE 'c' IMMUTABLE STRICT;
-- logic to create missing brin operators
-- note we can't use CREATE IF NOT EXISTS since not currently supported for operators or families
-- an earlier 2.3+ might miss this if doing upgrade from < 9.5 to 9.5+
-- so we need to include this always for 9.5+
-- Intentionally not indenting DDL cause our uninstall process can't pick it up
-- also not dollar quoting functions inside DO since gets tripped up by perl upgrade script parser
DO language 'plpgsql' $$
BEGIN
-- add geography brin ops if missing and are running a newer than 9.4 --
-- use wildcard since if schema postgis is installed is not in search path, will have schema name in front
IF NOT EXISTS(SELECT 1 from pg_operator WHERE oprname = '&&' AND
oprleft::regtype::text LIKE '%gidx' AND oprright::regtype::text LIKE '%geography' ) THEN
-- Availability: 2.3.0
CREATE OPERATOR && (
LEFTARG = gidx,
RIGHTARG = geography,
PROCEDURE = overlaps_geog,
COMMUTATOR = &&
);
-- Availability: 2.3.0
CREATE OR REPLACE FUNCTION overlaps_geog(geography, gidx)
RETURNS boolean
AS
'SELECT $2 OPERATOR(@extschema@.&&) $1;'
LANGUAGE SQL IMMUTABLE STRICT;
-- Availability: 2.3.0
CREATE OPERATOR && (
LEFTARG = geography,
RIGHTARG = gidx,
PROCEDURE = overlaps_geog,
COMMUTATOR = &&
);
-- Availability: 2.3.0
CREATE OPERATOR && (
LEFTARG = gidx,
RIGHTARG = gidx,
PROCEDURE = overlaps_geog,
COMMUTATOR = &&
);
--------------------------------
-- the OpFamily --
--------------------------------
-- Availability: 2.3.0
CREATE OPERATOR FAMILY brin_geography_inclusion_ops USING brin;
-- Availability: 2.3.0
CREATE OR REPLACE FUNCTION geog_brin_inclusion_add_value(internal, internal, internal, internal) RETURNS boolean
AS 'MODULE_PATHNAME','geog_brin_inclusion_add_value'
LANGUAGE 'c';
-- Availability: 2.3.0
CREATE OPERATOR CLASS brin_geography_inclusion_ops
DEFAULT FOR TYPE geography
USING brin
FAMILY brin_geography_inclusion_ops AS
OPERATOR 3 &&(geography, geography),
FUNCTION 1 brin_inclusion_opcinfo(internal) ,
FUNCTION 2 geog_brin_inclusion_add_value(internal, internal, internal, internal) ,
FUNCTION 3 brin_inclusion_consistent(internal, internal, internal) ,
FUNCTION 4 brin_inclusion_union(internal, internal, internal) ,
STORAGE gidx;
ALTER OPERATOR FAMILY brin_geography_inclusion_ops USING brin ADD
OPERATOR 3 &&(gidx, geography),
OPERATOR 3 &&(geography, gidx),
OPERATOR 3 &&(gidx, gidx);
END IF;
END;
$$;
---------------------------------------------------------------
-- END
---------------------------------------------------------------
#endif
\ No newline at end of file
......@@ -396,7 +396,6 @@ static bool box2df_overabove(const BOX2DF *a, const BOX2DF *b)
/**
* Calculate the centroid->centroid distance between the boxes.
* We return the square distance to avoid a call to sqrt.
*/
static double box2df_distance_leaf_centroid(const BOX2DF *a, const BOX2DF *b)
{
......@@ -407,7 +406,6 @@ static double box2df_distance_leaf_centroid(const BOX2DF *a, const BOX2DF *b)
double b_y = (b->ymax + b->ymin) / 2.0;
/* This "distance" is only used for comparisons, */
/* so for speed we drop contants and skip the sqrt step. */
return sqrt((a_x - b_x) * (a_x - b_x) + (a_y - b_y) * (a_y - b_y));
}
......@@ -499,27 +497,27 @@ static inline double pt_distance(double ax, double ay, double bx, double by)
*/
static double box2df_distance(const BOX2DF *a, const BOX2DF *b)
{
/* Check for overlap */
if ( box2df_overlaps(a, b) )
return 0.0;
/* Check for overlap */
if ( box2df_overlaps(a, b) )
return 0.0;
if ( box2df_left(a, b) )
{
if ( box2df_above(a, b) )
if ( box2df_left(a, b) )
{
if ( box2df_above(a, b) )
return pt_distance(a->xmax, a->ymin, b->xmin, b->ymax);
if ( box2df_below(a, b) )
return pt_distance(a->xmax, a->ymax, b->xmin, b->ymin);
else
return b->xmin - a->xmax;
return (double)b->xmin - (double)a->xmax;
}
if ( box2df_right(a, b) )
{
if ( box2df_above(a, b) )
if ( box2df_above(a, b) )
return pt_distance(a->xmin, a->ymin, b->xmax, b->ymax);
if ( box2df_below(a, b) )
return pt_distance(a->xmin, a->ymax, b->xmax, b->ymin);
else
return a->xmin - b->xmax;
return (double)a->xmin - (double)b->xmax;
}
if ( box2df_above(a, b) )
{
......@@ -528,7 +526,7 @@ static double box2df_distance(const BOX2DF *a, const BOX2DF *b)
if ( box2df_right(a, b) )
return pt_distance(a->xmin, a->ymin, b->xmax, b->ymax);
else
return a->ymin - b->ymax;
return (double)a->ymin - (double)b->ymax;
}
if ( box2df_below(a, b) )
{
......@@ -537,9 +535,9 @@ static double box2df_distance(const BOX2DF *a, const BOX2DF *b)
if ( box2df_right(a, b) )
return pt_distance(a->xmin, a->ymax, b->xmax, b->ymin);
else
return b->ymin - a->ymax;
return (double)b->ymin - (double)a->ymax;
}
return FLT_MAX;
}
......@@ -1202,7 +1200,7 @@ Datum gserialized_gist_distance_2d(PG_FUNCTION_ARGS)
/* Box-style distance test */
if ( strategy == 14 ) /* operator <#> */
{
distance = (double)box2df_distance(entry_box, &query_box);
distance = box2df_distance(entry_box, &query_box);
}
/* True distance test (formerly centroid distance) */
else if ( strategy == 13 ) /* operator <-> */
......@@ -1210,7 +1208,7 @@ Datum gserialized_gist_distance_2d(PG_FUNCTION_ARGS)
/* In all cases, since we only have keys (boxes) we'll return */
/* the minimum possible distance, which is the box2df_distance */
/* and let the recheck sort things out in the case of leaves */
distance = (double)box2df_distance(entry_box, &query_box);
distance = box2df_distance(entry_box, &query_box);
if (GIST_LEAF(entry))
*recheck = true;
......
This diff is collapsed.
This diff is collapsed.
......@@ -7,9 +7,9 @@
* Define just the version numbers; otherwise we get some strange substitutions in postgis.sql.in
*/
#define POSTGIS_PGSQL_VERSION 96
#define POSTGIS_GEOS_VERSION 36
#define POSTGIS_GEOS_VERSION 37
#define POSTGIS_PROJ_VERSION 49
#define POSTGIS_LIB_VERSION '2.3.1'
#define POSTGIS_LIB_VERSION '2.3.2'
#define POSTGIS_LIBXML2_VERSION 2.9.4
#define POSTGIS_SFCGAL_VERSION 13
......@@ -25,12 +25,12 @@
* won't substitute within apostrophes)
*/
#define _POSTGIS_SQL_SELECT_POSTGIS_VERSION 'SELECT ''2.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1''::text AS version'
#define _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE 'SELECT ''2016-11-28 15:14:03''::text AS version'
#define _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE 'SELECT ''2017-01-31 06:00:14''::text AS version'
#if POSTGIS_SVN_REVISION
#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.3.1'::text || ' r' || POSTGIS_SVN_REVISION::text AS version $$
#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.3.2'::text || ' r' || POSTGIS_SVN_REVISION::text AS version $$
#else
#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.3.1'::text AS version $$
#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.3.2'::text AS version $$
#endif
#define SRID_USR_MAX 998999
......
#define POSTGIS_SVN_REVISION 15264
#define POSTGIS_SVN_REVISION 15302
......@@ -223,3 +223,16 @@ DROP TABLE knn_recheck_geom_nd;
-- #3573
SELECT '#3573', 'POINT M (0 0 13)'::geometry <<->> 'LINESTRING M (0 0 5, 0 1 6)'::geometry;
-- #3418
CREATE TABLE test_wo (geo geometry);
INSERT INTO test_wo VALUES
('0101000020E61000007D91D0967329E4BF6631B1F9B8D64A40'::geometry),
('0101000020E6100000E2AFC91AF510C1BFCDCCCCCCCCAC4A40'::geometry);
CREATE INDEX ON TEST_WO USING GIST (GEO);
analyze test_wo;
SET enable_seqscan = false;
SELECT '#3418' As ticket, '0101000020E610000092054CE0D6DDE5BFCDCCCCCCCCAC4A40'::geometry <-> geo, ST_Distance('0101000020E610000092054CE0D6DDE5BFCDCCCCCCCCAC4A40'::geometry, geo)
FROM test_wo ORDER BY geo <->
('0101000020E610000092054CE0D6DDE5BFCDCCCCCCCCAC4A40'::geometry);
DROP TABLE test_wo;
set enable_seqscan to default;