Skip to content

Commit

Permalink
Stop deprecating ST_DWithin(text) while not being deprecated
Browse files Browse the repository at this point in the history
Fixes availability/changed info for ST_DWithin(..geometry..)
Add test for upgrades in presence of view using ST_DWithin(..geometry..)

Closes #5494 in 3.1 branch (3.1.10dev)
  • Loading branch information
strk committed Aug 30, 2023
1 parent f89d37c commit bb104ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
PostGIS 3.1.10
PostGIS 3.1.10dev
xxxx/xx/xx

* Bug Fixes *
- #5494, Fix double-upgrade with view using st_dwithin(text, ...)
(Sandro Santilli)
- #5450, Fix macro expansion recursion on powerpc architectures
(Bas Couwenberg)
- #5385, Postgres malloc assertion fail when using pg_cancel_backend
Expand Down
7 changes: 4 additions & 3 deletions postgis/postgis.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -4312,9 +4312,10 @@ CREATE OR REPLACE FUNCTION ST_LineCrossingDirection(line1 geometry, line2 geomet
LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
_COST_HIGH;

-- Availability: 1.3.4
-- Replaces ST_DWithin(text, text, float8) deprecated in 3.0.0
CREATE OR REPLACE FUNCTION ST_DWithin(geom1 geometry, geom2 geometry,float8)
-- Availability: 1.3.0
-- Changed: 2.0.0 added parameter names
-- TODO: encode deprecation of the version with no parameter names ?
CREATE OR REPLACE FUNCTION ST_DWithin(geom1 geometry, geom2 geometry, float8)
RETURNS boolean
AS 'MODULE_PATHNAME', 'LWGEOM_dwithin'
SUPPORT postgis_index_supportfn
Expand Down
13 changes: 8 additions & 5 deletions regress/hooks/hook-before-upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ SELECT
ST_AsKML(g2) as geography_askml
FROM upgrade_test;

-- Add view using ST_DWithin function
-- NOTE: 3.0.0 changed them to add default params
-- Add view using ST_DWithin functions
-- See https://trac.osgeo.org/postgis/ticket/5494
CREATE VIEW upgrade_view_test_dwithin AS
SELECT
ST_DWithin(g1::text, g1::text, 1) as text_dwithin,
ST_DWithin(g2, g2, 1) as geography_dwithin
FROM upgrade_test;
ST_DWithin(NULL::text, NULL::text, NULL::float8) as text_dwithin,
-- Available since 1.5.0, changed in 3.0.0 to add optional 4th use_spheroid param
ST_DWithin(NULL::geography, NULL::geography, NULL::float8) as geography_dwithin,
-- Available since 1.3.0
ST_DWithin(NULL::geometry, NULL::geometry, NULL::float8) as geometry_dwithin
;

-- Add view using ST_ClusterKMeans windowing function
-- NOTE: 3.2.0 changed it to add max_radius parameter
Expand Down

0 comments on commit bb104ff

Please sign in to comment.