Commit 28814812 authored by Bas Couwenberg's avatar Bas Couwenberg

Imported Upstream version 2.3.0~rc1+dfsg

parent 76e4c05f
......@@ -6,7 +6,7 @@ test-image: &test-image docker.kbt.io/postgis/build-test:trisquel
pipeline:
clone:
image: git
depth: 50
depth: 20
recursive: false
build:
image: *test-image
......
......@@ -10,6 +10,9 @@ end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[*_expected]
trim_trailing_whitespace = false
# C files want tab indentation
[*.{c,h}]
indent_style = tab
......
......@@ -6,9 +6,11 @@ PostGIS 2.3.0
- #3466, Casting from box3d to geometry now returns a 3D
geometry (Julien Rouhaud of Dalibo)
- #3604, pgcommon/Makefile.in orders
CFLAGS incorrectly leading to wrong liblwgeom.h
(Greg Troxel)
- #3604, pgcommon/Makefile.in orders CFLAGS incorrectly leading to
wrong liblwgeom.h (Greg Troxel)
- #3396, ST_EstimatedExtent, throw WARNING instead of ERROR
(Regina Obe)
* Deprecated signatures *
......@@ -37,26 +39,27 @@ PostGIS 2.3.0
- #3465, ST_ClusterKMeans (Paul Ramsey)
- #3469, ST_MakeLine with MULTIPOINTs (Paul Norman)
- #3549, Support PgSQL 9.6 parallel query mode, as far as possible
(Paul Ramsey, Regina Obe)
(Paul Ramsey, Regina Obe)
- #3557, Geometry function costs based on query stats (Paul Norman)
- #3591, Add support for BRIN indexes. PostgreSQL 9.4+ required.
(Giuseppe Broccolo of 2nd Quadrant, Julien Rouhaud and Ronan Dunklau of Dalibo)
- #3496, Make postgis non-relocateable (for extension install),
schema qualify calls in functions (Regina Obe)
Should resolve once and for all for extensions #3494, #3486, #3076
(Giuseppe Broccolo of 2nd Quadrant, Julien Rouhaud
and Ronan Dunklau of Dalibo)
- #3496, Make postgis non-relocateable for extension install,
schema qualify calls in functions (Regina Obe)
Should resolve once and for all for extensions #3494, #3486, #3076
- #3547, Update tiger geocoder to support TIGER 2016
and to support both http and ftp.
and to support both http and ftp.
* Performance Enhancements *
- #75, Enhancement to PIP short circuit (Dan Baston)
- #3383, Avoid deserializing small geometries during index operations
(Dan Baston)
(Dan Baston)
- #3400, Minor optimization of PIP routines (Dan Baston)
- Make adding a line to topology interruptible (Sandro Santilli)
- #3613, Segmentize geography using equal length segments, (Hugo Mercier of Oslandia)
- #3613, Segmentize geography using equal length segments
(Hugo Mercier of Oslandia)
PostGIS 2.3.0beta1
2016/09/06
See PostGIS 2.3.0 section for details
......
......@@ -5,7 +5,7 @@
POSTGIS_MAJOR_VERSION=2
POSTGIS_MINOR_VERSION=3
POSTGIS_MICRO_VERSION=0beta1
POSTGIS_MICRO_VERSION=0rc1
# Liblwgeom interface versioning, reset to 0:0:0 (cur:age:rev)
# when changing POSTGIS_MINOR_VERSION
......
......@@ -248,7 +248,7 @@ END
</question>
<answer>
<para>The function is not unique error happens if one of your arguments is a textual representation of a geometry instead of a geometry. In these cases, PostgreSQL marks the textual representation as an unknown type, which means it can fall into the st_intersects(raster, geometry) or st_intersects(raster,raster) thus resulting in a non-unique case since both functions can in theory support your request. To prevent this, you need to cast the geometry to a geometry.</para>
<para>The function is not unique error happens if one of your arguments is a textual representation of a geometry instead of a geometry. In these cases, PostgreSQL marks the textual representation as an unknown type, which means it can fall into the st_intersects(raster, geometry) or st_intersects(raster,raster) thus resulting in a non-unique case since both functions can in theory support your request. To prevent this, you need to cast the textual representation of the geometry to a geometry.</para>
<para>For example if your code looks like this:</para>
<programlisting>SELECT rast
FROM my_raster
......
......@@ -425,7 +425,7 @@ LINESTRING(-113.98 39.198,-113.981 39.195)
\\312Q\\300\\366{b\\235*!E@\\225|\\354.P\\312Q
\\300p\\231\\323e1!E@');</programlisting>
<note><para>In PostgreSQL 9.1+ - standard_conforming_strings is set to on by default, where as in past versions it was set to on. You can change defaults as needed
<note><para>In PostgreSQL 9.1+ - standard_conforming_strings is set to on by default, where as in past versions it was set to off. You can change defaults as needed
for a single query or at the database or server level. Below is how you would do it with standard_conforming_strings = on. In this case we escape the ' with standard ansi ',
but slashes are not escaped</para></note>
<programlisting>
......
......@@ -6423,12 +6423,17 @@ SELECT ST_PixelWidth(ST_Rescale(ST_AddBand(ST_MakeEmptyRaster(100, 100, 0, 0, 0.
<title>Examples</title>
<para>A simple example reskewing a raster from a skew of 0.0 to a skew of 0.0015.</para>
<programlisting>-- the original raster pixel size
SELECT ST_Rotation(ST_AddBand(ST_MakeEmptyRaster(100, 100, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0))
<programlisting>-- the original raster non-rotated
SELECT ST_Rotation(ST_AddBand(ST_MakeEmptyRaster(100, 100, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0));
-- the rescaled raster raster pixel size
SELECT ST_Rotation(ST_Reskew(ST_AddBand(ST_MakeEmptyRaster(100, 100, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0), 0.0015))
</programlisting>
-- result
0
-- the reskewed raster raster rotation
SELECT ST_Rotation(ST_Reskew(ST_AddBand(ST_MakeEmptyRaster(100, 100, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0), 0.0015));
-- result
-0.982793723247329</programlisting>
</refsection>
......@@ -6506,12 +6511,16 @@ SELECT ST_Rotation(ST_Reskew(ST_AddBand(ST_MakeEmptyRaster(100, 100, 0, 0, 0.001
<title>Examples</title>
<para>A simple example snapping a raster to a slightly different grid.</para>
<programlisting>-- the original raster pixel size
SELECT ST_UpperLeftX(ST_AddBand(ST_MakeEmptyRaster(10, 10, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0))
<programlisting>-- the original raster upper left X
SELECT ST_UpperLeftX(ST_AddBand(ST_MakeEmptyRaster(10, 10, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0));
-- result
0
-- the upper left of raster after snapping
SELECT ST_UpperLeftX(ST_SnapToGrid(ST_AddBand(ST_MakeEmptyRaster(10, 10, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0), 0.0002, 0.0002));
-- the rescaled raster raster pixel size
SELECT ST_UpperLeftX(ST_SnapToGrid(ST_AddBand(ST_MakeEmptyRaster(10, 10, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0), 0.0002, 0.0002))
</programlisting>
--result
-0.0008</programlisting>
</refsection>
......
......@@ -30,14 +30,14 @@ POSTGIS_PGSQL_VERSION=95
SQLPP = /usr/bin/cpp -traditional-cpp -w -P
GREP=/bin/grep
PERL=/usr/bin/perl
EXTVERSION = 2.3.0beta1
EXTVERSION = 2.3.0rc1
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.0beta1.sql sql/$(EXTENSION)_data_us--2.3.0beta1.sql sql/$(EXTENSION)_data_us--$(EXTVERSION)--$(EXTVERSION)next.sql \
sql/$(EXTENSION)_data_us.sql sql/address_standardizer--2.3.0rc1.sql sql/$(EXTENSION)_data_us--2.3.0rc1.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
......@@ -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.0beta1.sql: sql/address_standardizer_types.sql \
sql/address_standardizer--2.3.0rc1.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.0beta1'
default_version = '2.3.0rc1'
relocatable = true
# address standardizer us dataset
comment = 'Address Standardizer US dataset example'
default_version = '2.3.0beta1'
default_version = '2.3.0rc1'
relocatable = true
include ../upgradeable_versions.mk
EXTENSION = postgis
EXTVERSION = 2.3.0beta1
EXTVERSION = 2.3.0rc1
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.0beta1'
default_version = '2.3.0rc1'
module_pathname = '$libdir/postgis-2.3'
relocatable = false
include ../upgradeable_versions.mk
EXTENSION = postgis_sfcgal
EXTVERSION = 2.3.0beta1
EXTVERSION = 2.3.0rc1
MINORVERSION = 2.3
GREP = /bin/grep
PERL = /usr/bin/perl
......
# postgis topology extension
comment = 'PostGIS SFCGAL functions'
default_version = '2.3.0beta1'
default_version = '2.3.0rc1'
relocatable = true
requires = postgis
include ../upgradeable_versions.mk
EXTENSION = postgis_tiger_geocoder
EXTVERSION = 2.3.0beta1
EXTVERSION = 2.3.0rc1
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.0beta1'
default_version = '2.3.0rc1'
relocatable = false
schema = tiger
requires = 'postgis,fuzzystrmatch'
include ../upgradeable_versions.mk
EXTENSION = postgis_topology
EXTVERSION = 2.3.0beta1
EXTVERSION = 2.3.0rc1
MINORVERSION = 2.3
GREP = /bin/grep
PERL = /usr/bin/perl
......
# postgis topology extension
comment = 'PostGIS topology spatial types and functions'
default_version = '2.3.0beta1'
default_version = '2.3.0rc1'
relocatable = false
schema = topology
requires = postgis
......@@ -20,7 +20,9 @@ UPGRADEABLE_VERSIONS = \
2.2.0 \
2.2.1 \
2.2.2 \
2.3.0dev
2.3.0dev \
2.3.0beta1 \
2.3.0rc1dev
# This is to avoid forcing "check-installed-upgrades" as a default
# rule, see https://trac.osgeo.org/postgis/ticket/3420
......
......@@ -1102,6 +1102,46 @@ static void test_point_density(void)
lwgeom_free(geom);
}
static void test_lwpoly_construct_circle(void)
{
LWPOLY* p;
GBOX* g;
const int srid = 4326;
const int segments_per_quad = 17;
const int x = 10;
const int y = 20;
const int r = 5;
/* With normal arguments you should get something circle-y */
p = lwpoly_construct_circle(srid, x, y, r, segments_per_quad, LW_TRUE);
ASSERT_INT_EQUAL(lwgeom_count_vertices(p), segments_per_quad * 4 + 1);
ASSERT_INT_EQUAL(lwgeom_get_srid(lwpoly_as_lwgeom(p)), srid)
g = lwgeom_get_bbox(lwpoly_as_lwgeom(p));
CU_ASSERT_DOUBLE_EQUAL(g->xmin, x-r, 0.1);
CU_ASSERT_DOUBLE_EQUAL(g->xmax, x+r, 0.1);
CU_ASSERT_DOUBLE_EQUAL(g->ymin, y-r, 0.1);
CU_ASSERT_DOUBLE_EQUAL(g->ymax, y+r, 0.1);
CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(p), M_PI*5*5, 0.1);
lwpoly_free(p);
/* No segments? No circle. */
p = lwpoly_construct_circle(srid, x, y, r, 0, LW_TRUE);
CU_ASSERT_TRUE(p == NULL);
/* Negative radius? No circle. */
p = lwpoly_construct_circle(srid, x, y, -1e-3, segments_per_quad, LW_TRUE);
CU_ASSERT_TRUE(p == NULL);
/* Zero radius? Invalid circle */
p = lwpoly_construct_circle(srid, x, y, 0, segments_per_quad, LW_TRUE);
CU_ASSERT_TRUE(p != NULL);
lwpoly_free(p);
}
static void test_kmeans(void)
{
static int cluster_size = 100;
......@@ -1172,4 +1212,5 @@ void algorithms_suite_setup(void)
PG_ADD_TEST(suite,test_kmeans);
PG_ADD_TEST(suite,test_median_handles_3d_correctly);
PG_ADD_TEST(suite,test_median_robustness);
PG_ADD_TEST(suite,test_lwpoly_construct_circle);
}
......@@ -1042,7 +1042,12 @@ extern LWCURVEPOLY* lwcurvepoly_construct_from_lwpoly(LWPOLY *lwpoly);
extern int lwcollection_ngeoms(const LWCOLLECTION *col);
/* Given a generic geometry/collection, return the "simplest" form. */
/* Given a generic geometry/collection, return the "simplest" form.
* The elements of the homogenized collection are references to the
* input geometry; a deep clone is not performed.
* TODO: consider returning a geometry that does not reference the
* input
* */
extern LWGEOM *lwgeom_homogenize(const LWGEOM *geom);
......@@ -1352,6 +1357,7 @@ extern LWLINE *lwline_removepoint(LWLINE *line, uint32_t which);
extern void lwline_setPoint4d(LWLINE *line, uint32_t which, POINT4D *newpoint);
extern LWPOLY *lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes);
extern LWPOLY* lwpoly_construct_rectangle(char hasz, char hasm, POINT4D *p1, POINT4D *p2, POINT4D *p3, POINT4D *p4);
extern LWPOLY* lwpoly_construct_circle(int srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior);
extern LWTRIANGLE *lwtriangle_from_lwline(const LWLINE *shell);
extern LWMPOINT *lwmpoint_from_lwgeom(const LWGEOM *g); /* Extract the coordinates of an LWGEOM into an LWMPOINT */
......
......@@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "liblwgeom_internal.h"
#include "lwgeom_log.h"
......@@ -93,6 +94,45 @@ lwpoly_construct_rectangle(char hasz, char hasm, POINT4D *p1, POINT4D *p2,
return lwpoly;
}
LWPOLY*
lwpoly_construct_circle(int srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior)
{
const int segments = 4*segments_per_quarter;
const double theta = 2*M_PI / segments;
LWPOLY *lwpoly;
POINTARRAY *pa;
POINT4D pt;
uint32_t i;
if (segments_per_quarter < 1)
{
lwerror("Need at least one segment per quarter-circle.");
return NULL;
}
if (radius < 0)
{
lwerror("Radius must be positive.");
return NULL;
}
lwpoly = lwpoly_construct_empty(srid, LW_FALSE, LW_FALSE);
pa = ptarray_construct_empty(LW_FALSE, LW_FALSE, segments + 1);
if (exterior)
radius *= sqrt(1 + pow(tan(theta/2), 2));
for (i = 0; i <= segments; i++)
{
pt.x = x + radius*sin(i * theta);
pt.y = y + radius*cos(i * theta);
ptarray_append_point(pa, &pt, LW_TRUE);
}
lwpoly_add_ring(lwpoly, pa);
return lwpoly;
}
LWPOLY*
lwpoly_construct_empty(int srid, char hasz, char hasm)
{
......
......@@ -2253,8 +2253,10 @@ Datum gserialized_estimated_extent(PG_FUNCTION_ARGS)
nd_stats = pg_get_nd_stats_by_name(tbl_oid, col, 2, only_parent);
/* Error out on no stats */
if ( ! nd_stats )
elog(ERROR, "stats for \"%s.%s\" do not exist", tbl, text2cstring(col));
if ( ! nd_stats ) {
elog(WARNING, "stats for \"%s.%s\" do not exist", tbl, text2cstring(col));
PG_RETURN_NULL();
}
/* Construct the box */
gbox = palloc(sizeof(GBOX));
......
......@@ -637,9 +637,9 @@ Datum LWGEOM_asEncodedPolyline(PG_FUNCTION_ARGS)
lwgeom = lwgeom_from_gserialized(geom);
PG_FREE_IF_COPY(geom, 0);
if (PG_NARGS() >2 && !PG_ARGISNULL(2))
if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
{
precision = PG_GETARG_INT32(2);
precision = PG_GETARG_INT32(1);
if ( precision < 0 ) precision = 5;
}
......
......@@ -53,6 +53,7 @@ Datum LWGEOM_simplify2d(PG_FUNCTION_ARGS);
Datum LWGEOM_SetEffectiveArea(PG_FUNCTION_ARGS);
Datum ST_LineCrossingDirection(PG_FUNCTION_ARGS);
Datum ST_MinimumBoundingRadius(PG_FUNCTION_ARGS);
Datum ST_MinimumBoundingCircle(PG_FUNCTION_ARGS);
Datum ST_GeometricMedian(PG_FUNCTION_ARGS);
......@@ -1110,7 +1111,7 @@ Datum ST_MinimumBoundingRadius(PG_FUNCTION_ARGS)
input = lwgeom_from_gserialized(geom);
mbc = lwgeom_calculate_mbc(input);
if (!mbc)
if (!(mbc && mbc->center))
{
lwpgerror("Error calculating minimum bounding circle.");
lwgeom_free(input);
......@@ -1142,6 +1143,61 @@ Datum ST_MinimumBoundingRadius(PG_FUNCTION_ARGS)
PG_RETURN_DATUM(result);
}
/**********************************************************************
*
* ST_MinimumBoundingCircle
*
**********************************************************************/
PG_FUNCTION_INFO_V1(ST_MinimumBoundingCircle);
Datum ST_MinimumBoundingCircle(PG_FUNCTION_ARGS)
{
GSERIALIZED* geom;
LWGEOM* input;
LWBOUNDINGCIRCLE* mbc = NULL;
LWGEOM* lwcircle;
GSERIALIZED* center;
int segs_per_quarter;
if (PG_ARGISNULL(0))
PG_RETURN_NULL();
geom = PG_GETARG_GSERIALIZED_P(0);
segs_per_quarter = PG_GETARG_INT32(1);
/* Empty geometry? Return POINT EMPTY */
if (gserialized_is_empty(geom))
{
lwcircle = (LWGEOM*) lwpoint_construct_empty(gserialized_get_srid(geom), LW_FALSE, LW_FALSE);
}
else
{
input = lwgeom_from_gserialized(geom);
mbc = lwgeom_calculate_mbc(input);
if (!(mbc && mbc->center))
{
lwpgerror("Error calculating minimum bounding circle.");
lwgeom_free(input);
PG_RETURN_NULL();
}
/* Zero radius? Return a point. */
if (mbc->radius == 0)
lwcircle = lwpoint_as_lwgeom(lwpoint_make2d(input->srid, mbc->center->x, mbc->center->y));
else
lwcircle = lwpoly_as_lwgeom(lwpoly_construct_circle(input->srid, mbc->center->x, mbc->center->y, mbc->radius, segs_per_quarter, LW_TRUE));
lwboundingcircle_destroy(mbc);
lwgeom_free(input);
}
center = geometry_serialize(lwcircle);
lwgeom_free(lwcircle);
PG_RETURN_POINTER(center);
}
/**********************************************************************
*
* ST_GeometricMedian
......
......@@ -2643,14 +2643,17 @@ Datum ST_CollectionHomogenize(PG_FUNCTION_ARGS)
lwoutput = lwgeom_homogenize(lwgeom);
lwgeom_free(lwgeom);
PG_FREE_IF_COPY(input, 0);
if ( ! lwoutput )
{
PG_RETURN_NULL();
PG_FREE_IF_COPY(input, 0);
}
output = geometry_serialize(lwoutput);
lwgeom_free(lwoutput);
PG_FREE_IF_COPY(input, 0);
PG_RETURN_POINTER(output);
}
......@@ -2701,7 +2704,7 @@ Datum ST_FlipCoordinates(PG_FUNCTION_ARGS)
static LWORD ordname2ordval(char n)
{
if ( n == 'x' || n == 'X' ) return LWORD_X;
if ( n == 'y' || n == 'y' ) return LWORD_Y;
if ( n == 'y' || n == 'Y' ) return LWORD_Y;
if ( n == 'z' || n == 'Z' ) return LWORD_Z;
if ( n == 'm' || n == 'M' ) return LWORD_M;
lwpgerror("Invalid ordinate name '%c'. Expected x,y,z or m", n);
......
......@@ -47,9 +47,9 @@ Datum line_from_encoded_polyline(PG_FUNCTION_ARGS)
encodedpolyline_input = PG_GETARG_TEXT_P(0);
encodedpolyline = text2cstring(encodedpolyline_input);
if (PG_NARGS() >2 && !PG_ARGISNULL(2))
if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
{
precision = PG_GETARG_INT32(2);
precision = PG_GETARG_INT32(1);
if ( precision < 0 ) precision = 5;
}
......
......@@ -3305,9 +3305,9 @@ CREATE OR REPLACE FUNCTION ST_MinimumBoundingRadius(geometry, OUT center geometr
-- Availability: 1.4.0
CREATE OR REPLACE FUNCTION ST_MinimumBoundingCircle(inputgeom geometry, segs_per_quarter integer DEFAULT 48)
RETURNS geometry
AS $$ SELECT @extschema@.ST_Buffer(center, radius, segs_per_quarter) FROM @extschema@.ST_MinimumBoundingRadius($1) sq $$
LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
RETURNS geometry
AS 'MODULE_PATHNAME', 'ST_MinimumBoundingCircle'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-- Availability: 2.0.0 - requires GEOS-3.2 or higher
CREATE OR REPLACE FUNCTION ST_OffsetCurve(line geometry, distance float8, params text DEFAULT '')
......
......@@ -9,7 +9,7 @@
#define POSTGIS_PGSQL_VERSION 95
#define POSTGIS_GEOS_VERSION 35
#define POSTGIS_PROJ_VERSION 49
#define POSTGIS_LIB_VERSION '2.3.0beta1'
#define POSTGIS_LIB_VERSION '2.3.0rc1'
#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-09-06 06:24:58''::text AS version'
#define _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE 'SELECT ''2016-09-19 05:38:21''::text AS version'
#if POSTGIS_SVN_REVISION
#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.3.0beta1'::text || ' r' || POSTGIS_SVN_REVISION::text AS version $$
#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.3.0rc1'::text || ' r' || POSTGIS_SVN_REVISION::text AS version $$
#else
#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.3.0beta1'::text AS version $$
#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '2.3.0rc1'::text AS version $$
#endif
#define SRID_USR_MAX 998999
......
#define POSTGIS_SVN_REVISION 15063
#define POSTGIS_SVN_REVISION 15121
......@@ -54,7 +54,7 @@ OBJS = \
# Note: we specify liblwgeom.a directly in SHLIB_LINK rather than using
# -L... -l options to prevent issues with some platforms trying to link
# to an existing liblwgeom.so in the PostgreSQL $libdir supplied by an
# older version of PostGIS, rather than with the static liblwgeom.a
# older version of PostGIS, rather than with the static liblwgeom.a
# supplied with newer versions of PostGIS
#
LIBLWGEOM_LDFLAGS=../../liblwgeom/.libs/liblwgeom.a
......@@ -67,13 +67,13 @@ LIBPROJ_CFLAGS=@PROJ_CPPFLAGS@
override CFLAGS := $(LIBLWGEOM_CFLAGS) $(CFLAGS)
PG_CPPFLAGS+= @CPPFLAGS@ $(LIBGDAL_CFLAGS) $(LIBPGCOMMON_CFLAGS) $(LIBPROJ_CFLAGS) -I../rt_core
SHLIB_LINK_F = ../rt_core/librtcore.a $(LIBLWGEOM_LDFLAGS) $(LIBPGCOMMON_LDFLAGS) $(LIBGDAL_LDFLAGS) @SHLIB_LINK@
SHLIB_LINK_F = ../rt_core/librtcore.a $(LIBLWGEOM_LDFLAGS) $(LIBPGCOMMON_LDFLAGS) $(LIBGDAL_LDFLAGS) @SHLIB_LINK@
# Extra files to remove during 'make clean'
EXTRA_CLEAN=$(SQL_OBJS) $(DATA_built) rtpostgis_upgrade.sql.in
EXTRA_CLEAN=$(SQL_OBJS) $(DATA_built) rtpostgis_upgrade.sql.in rtpostgis_upgrade_for_extension.sql.in
# PGXS information
PG_CONFIG = @PG_CONFIG@
PG_CONFIG = @PG_CONFIG@
PGXS := @PGXS@
# NO_TEMP_INSTALL is a workaround for a 9.5dev bug. See:
# http://www.postgresql.org/message-id/CAB7nPqTsR5o3g-fBi6jbsVdhfPiLFWQ_0cGU5=94Rv_8W3qvFA@mail.gmail.com
......@@ -103,7 +103,7 @@ endif
%.sql: %.sql.in
$(SQLPP) -I../../postgis/ -I../../ $< | grep -v '^#' | \
$(PERL) -lpe "s'MODULE_PATHNAME'\$$libdir/rtpostgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@'g;s'@extschema@\.''g" > $@
rtpostgis_for_extension.sql: rtpostgis.sql.in
$(SQLPP) -I../../postgis/ -I../../ $< | grep -v '^#' | \
$(PERL) -lpe "s'MODULE_PATHNAME'\$$libdir/rtpostgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@'g" > $@
......@@ -128,10 +128,10 @@ $(SQL_OBJS): ../../postgis/sqldefines.h ../../postgis_svn_revision.h
#this is redundant but trying to fold in with the other just hangs
rtpostgis_upgrade.sql.in: rtpostgis.sql ../../utils/postgis_proc_upgrade.pl
$(PERL) ../../utils/postgis_proc_upgrade.pl $< UNUSED > $@
rtpostgis_upgrade_for_extension.sql.in: rtpostgis_for_extension.sql ../../utils/postgis_proc_upgrade.pl
$(PERL) ../../utils/postgis_proc_upgrade.pl $< UNUSED > $@
rtpostgis_proc_set_search_path.sql: rtpostgis.sql ../../utils/postgis_proc_set_search_path.pl
$(PERL) ../../utils/postgis_proc_set_search_path.pl $< UNUSED > $@
......@@ -139,14 +139,14 @@ rtpostgis_upgrade.sql: rtpostgis_upgrade_cleanup.sql rtpostgis_upgrade.sql.in rt
echo 'BEGIN;' > $@
cat $^ | sed -e 's/^BEGIN;$$//' -e 's/^COMMIT;$$//' >> $@
echo 'COMMIT;' >> $@
#this keeps the @extschema@. in place since extension machinery will replace during install
rtpostgis_upgrade_for_extension.sql: rtpostgis_upgrade_cleanup.sql rtpostgis_upgrade_for_extension.sql.in rtpostgis_drop.sql
echo 'BEGIN;' > $@
cat $^ | sed -e 's/^BEGIN;$$//' -e 's/^COMMIT;$$//' >> $@
echo 'COMMIT;' >> $@
uninstall_rtpostgis.sql: rtpostgis.sql ../../utils/create_undef.pl
uninstall_rtpostgis.sql: rtpostgis.sql ../../utils/create_undef.pl
$(PERL) ../../utils/create_undef.pl $< $(POSTGIS_PGSQL_VERSION) > $@
distclean: clean
......
......@@ -7148,7 +7148,7 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_extent(rastschema name, rastta
cn := 'enforce_max_extent_' || $3;
sql := 'SELECT st_ashexewkb(st_envelope(st_collect(st_envelope('
sql := 'SELECT @extschema@.st_ashexewkb( @extschema@.st_envelope( @extschema@.st_union( @extschema@.st_envelope('
|| quote_ident($3)
|| ')))) FROM '
|| fqtn;
......@@ -7202,7 +7202,7 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_alignment(rastschema name, ras
cn := 'enforce_same_alignment_' || $3;
sql := 'SELECT st_makeemptyraster(1, 1, upperleftx, upperlefty, scalex, scaley, skewx, skewy, srid) FROM st_metadata((SELECT '
sql := 'SELECT @extschema@.st_makeemptyraster(1, 1, upperleftx, upperlefty, scalex, scaley, skewx, skewy, srid) FROM @extschema@.st_metadata((SELECT '
|| quote_ident($3)
|| ' FROM ' || fqtn || ' LIMIT 1))';
BEGIN
......@@ -7342,7 +7342,7 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_coverage_tile(rastschema name,
-- metadata
BEGIN
sql := 'WITH foo AS (SELECT ST_Metadata(' || quote_ident($3) || ') AS meta, ST_ConvexHull(' || quote_ident($3) || ') AS hull FROM ' || fqtn || ') SELECT max((meta).scalex), max((meta).scaley), max((meta).skewx), max((meta).skewy), max((meta).width), max((meta).height), ST_Union(hull) FROM foo';
sql := 'WITH foo AS (SELECT @extschema@.ST_Metadata(' || quote_ident($3) || ') AS meta, @extschema@.ST_ConvexHull(' || quote_ident($3) || ') AS hull FROM ' || fqtn || ') SELECT max((meta).scalex), max((meta).scaley), max((meta).skewx), max((meta).skewy), max((meta).width), max((meta).height), @extschema@.ST_Union(hull) FROM foo';
EXECUTE sql INTO _scalex, _scaley, _skewx, _skewy, _tilewidth, _tileheight, _covextent;
EXCEPTION WHEN OTHERS THEN
RAISE DEBUG 'Unable to get coverage metadata for %.%: % (%)',
......@@ -7352,7 +7352,7 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_coverage_tile(rastschema name,
-- rasterize extent
BEGIN
_covrast := ST_AsRaster(_covextent, _scalex, _scaley, '8BUI', 1, 0, NULL, NULL, _skewx, _skewy);
_covrast := @extschema@.ST_AsRaster(_covextent, _scalex, _scaley, '8BUI', 1, 0, NULL, NULL, _skewx, _skewy);
IF _covrast IS NULL THEN
RAISE NOTICE 'Unable to create coverage raster. Cannot add coverage tile constraint: % (%)',
SQLERRM, SQLSTATE;
......@@ -7441,7 +7441,7 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_num_bands(rastschema name, ras
cn := 'enforce_num_bands_' || $3;
sql := 'SELECT st_numbands(' || quote_ident($3)
sql := 'SELECT @extschema@.st_numbands(' || quote_ident($3)
|| ') FROM ' || fqtn
|| ' LIMIT 1';
BEGIN
......@@ -7454,7 +7454,7 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_num_bands(rastschema name, ras
sql := 'ALTER TABLE ' || fqtn
|| ' ADD CONSTRAINT ' || quote_ident(cn)
|| ' CHECK (st_numbands(' || quote_ident($3)
|| ' CHECK (@extschema@.st_numbands(' || quote_ident($3)
|| ') = ' || attr
|| ')';
RETURN @extschema@._add_raster_constraint(cn, sql);
......@@ -7703,7 +7703,7 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_out_db(rastschema name, rastta
sql := 'ALTER TABLE ' || fqtn
|| ' ADD CONSTRAINT ' || quote_ident(cn)
|| ' CHECK (_raster_constraint_out_db(' || quote_ident($3)
|| ' CHECK ( @extschema@._raster_constraint_out_db(' || quote_ident($3)
|| ') = ''{';
FOR x in 1..max LOOP
IF attr[x] IS FALSE THEN
......@@ -8775,7 +8775,8 @@ BEGIN
PERFORM @extschema@.AddOverviewConstraints(sinfo.sch, ttab, col,
sinfo.sch, sinfo.tab, col, factor);
RETURN ttab;
-- return the schema as well as the table
RETURN sinfo.sch||'.'||ttab;
END;
$$ LANGUAGE 'plpgsql' VOLATILE STRICT;
......
SET client_min_messages TO warning;
-- Test for table without explicit schema
CREATE TABLE res1 AS SELECT
ST_AddBand(