[postgis-tickets] r16045 - Replace the 3 ST_CurveToLine signatures with a single one

Sandro Santilli strk at kbt.io
Sun Oct 22 10:54:09 PDT 2017


Author: strk
Date: 2017-10-22 10:54:09 -0700 (Sun, 22 Oct 2017)
New Revision: 16045

Modified:
   trunk/doc/reference_processing.xml
   trunk/postgis/postgis.sql.in
   trunk/postgis/postgis_drop_before.sql
Log:
Replace the 3 ST_CurveToLine signatures with a single one

The new one uses defaults for arguments

Modified: trunk/doc/reference_processing.xml
===================================================================
--- trunk/doc/reference_processing.xml	2017-10-22 17:40:18 UTC (rev 16044)
+++ trunk/doc/reference_processing.xml	2017-10-22 17:54:09 UTC (rev 16045)
@@ -839,18 +839,9 @@
 		  <funcprototype>
 			<funcdef>geometry <function>ST_CurveToLine</function></funcdef>
 			<paramdef><type>geometry</type> <parameter>curveGeom</parameter></paramdef>
-		  </funcprototype>
-		  <funcprototype>
-			<funcdef>geometry <function>ST_CurveToLine</function></funcdef>
-			<paramdef><type>geometry</type> <parameter>curveGeom</parameter></paramdef>
-			<paramdef><type>integer</type> <parameter>segments_per_qtr_circle</parameter></paramdef>
-		  </funcprototype>
-		  <funcprototype>
-			<funcdef>geometry <function>ST_CurveToLine</function></funcdef>
-			<paramdef><type>geometry</type> <parameter>curveGeom</parameter></paramdef>
 			<paramdef><type>float</type> <parameter>tolerance</parameter></paramdef>
-			<paramdef><type>integer</type> <parameter>tolerance_type</parameter></paramdef>
-			<paramdef><type>integer</type> <parameter>flags</parameter></paramdef>
+			<paramdef choice="opt"><type>integer</type> <parameter>tolerance_type</parameter></paramdef>
+			<paramdef choice="opt"><type>integer</type> <parameter>flags</parameter></paramdef>
 		  </funcprototype>
 		</funcsynopsis>
 	  </refsynopsisdiv>

Modified: trunk/postgis/postgis.sql.in
===================================================================
--- trunk/postgis/postgis.sql.in	2017-10-22 17:40:18 UTC (rev 16044)
+++ trunk/postgis/postgis.sql.in	2017-10-22 17:54:09 UTC (rev 16045)
@@ -5674,33 +5674,10 @@
 --
 -- Availability: 2.4.0
 --
-CREATE OR REPLACE FUNCTION ST_CurveToLine(geom geometry, tol float8, toltype integer, flags integer)
+CREATE OR REPLACE FUNCTION ST_CurveToLine(geom geometry, tol float8 DEFAULT 32, toltype integer DEFAULT 0, flags integer DEFAULT 0)
 	RETURNS geometry
 	AS 'MODULE_PATHNAME', 'ST_CurveToLine'
 	LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
---
--- SQL-MM
---
--- ST_CurveToLine(Geometry geometry, SegmentsPerQuarter integer)
---
--- Converts a given geometry to a linear geometry.  Each curveed
--- geometry or segment is converted into a linear approximation using
--- the given number of segments per quarter circle.
---
-CREATE OR REPLACE FUNCTION ST_CurveToLine(geometry, integer)
-	RETURNS geometry AS 'SELECT ST_CurveToLine($1, $2::float8, 0, 0)'
-	LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
---
--- SQL-MM
---
--- ST_CurveToLine(Geometry geometry, SegmentsPerQuarter integer)
---
--- Converts a given geometry to a linear geometry.  Each curveed
--- geometry or segment is converted into a linear approximation using
--- the default value of 32 segments per quarter circle
-CREATE OR REPLACE FUNCTION ST_CurveToLine(geometry)
-	RETURNS geometry AS 'SELECT ST_CurveToLine($1, 32::integer)'
-	LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
 
 CREATE OR REPLACE FUNCTION ST_HasArc(Geometry geometry)
 	RETURNS boolean

Modified: trunk/postgis/postgis_drop_before.sql
===================================================================
--- trunk/postgis/postgis_drop_before.sql	2017-10-22 17:40:18 UTC (rev 16044)
+++ trunk/postgis/postgis_drop_before.sql	2017-10-22 17:54:09 UTC (rev 16045)
@@ -73,5 +73,9 @@
 DROP AGGREGATE IF EXISTS ST_AsGeobuf(text, anyelement);
 DROP FUNCTION IF EXISTS pgis_asgeobuf_transfn(internal, text, anyelement);
 DROP FUNCTION IF EXISTS pgis_asmvt_transfn(internal, text, int4, text, anyelement);
+-- Going from multiple functions to default args
+-- Need to drop old multiple variants to not get in trouble.
+DROP FUNCTION IF EXISTS  ST_CurveToLine(geometry, integer);
+DROP FUNCTION IF EXISTS  ST_CurveToLine(geometry);
 
 DROP VIEW IF EXISTS geometry_columns; -- removed cast 2.2.0 so need to recreate



More information about the postgis-tickets mailing list