[postgis-tickets] r17508 - Rename update sql files

Raul raul at rmr.ninja
Wed Jun 12 03:30:22 PDT 2019


Author: algunenano
Date: 2019-06-12 03:30:22 -0700 (Wed, 12 Jun 2019)
New Revision: 17508

Added:
   trunk/postgis/postgis_after_upgrade.sql
   trunk/postgis/postgis_before_upgrade.sql
Removed:
   trunk/postgis/postgis_drop_after.sql
   trunk/postgis/postgis_drop_before.sql
Modified:
   trunk/extensions/postgis/Makefile.in
   trunk/postgis/Makefile.in
   trunk/postgis/postgis.sql.in
   trunk/utils/Makefile.in
Log:
Rename update sql files

postgis/postgis_drop_after.sql -> postgis/postgis_after_upgrade.sql
postgis/postgis_drop_before.sql -> postgis/postgis_before_upgrade.sql

Closes #4334



Modified: trunk/extensions/postgis/Makefile.in
===================================================================
--- trunk/extensions/postgis/Makefile.in	2019-06-12 09:49:20 UTC (rev 17507)
+++ trunk/extensions/postgis/Makefile.in	2019-06-12 10:30:22 UTC (rev 17508)
@@ -119,7 +119,7 @@
 sql/spatial_ref_sys_config_dump.sql: ../../spatial_ref_sys.sql ../../utils/create_spatial_ref_sys_config_dump.pl | sql
 	$(PERL) ../../utils/create_spatial_ref_sys_config_dump.pl $< > $@
 
-sql/postgis_upgrade_for_extension.sql: ../../postgis/postgis_drop_before.sql sql/postgis_upgrade_for_extension.sql.in ../../postgis/postgis_drop_after.sql | sql
+sql/postgis_upgrade_for_extension.sql: ../../postgis/postgis_before_upgrade.sql sql/postgis_upgrade_for_extension.sql.in ../../postgis/postgis_after_upgrade.sql | sql
 	#strip BEGIN/COMMIT since these are not allowed in extensions
 	# WARNING: we should make sure these are not internal to function bodies
 	cat $^ | $(PERL) -pe 's/BEGIN\;//g ; s/COMMIT\;//g' > $@

Modified: trunk/postgis/Makefile.in
===================================================================
--- trunk/postgis/Makefile.in	2019-06-12 09:49:20 UTC (rev 17507)
+++ trunk/postgis/Makefile.in	2019-06-12 10:30:22 UTC (rev 17508)
@@ -238,7 +238,7 @@
 postgis_proc_set_search_path.sql: postgis.sql ../utils/postgis_proc_set_search_path.pl
 	$(PERL) ../utils/postgis_proc_set_search_path.pl $< UNUSED > $@
 
-postgis_upgrade.sql: postgis_drop_before.sql postgis_upgrade.sql.in postgis_drop_after.sql
+postgis_upgrade.sql: postgis_before_upgrade.sql postgis_upgrade.sql.in postgis_after_upgrade.sql
 	echo "BEGIN;" > $@
 	cat $^ >> $@
 	echo "COMMIT;" >> $@
@@ -246,7 +246,7 @@
 sfcgal_upgrade.sql.in: sfcgal.sql ../utils/postgis_proc_upgrade.pl
 	$(PERL) ../utils/postgis_proc_upgrade.pl $< UNUSED > $@
 
-sfcgal_upgrade.sql: sfcgal_upgrade.sql.in postgis_drop_after.sql
+sfcgal_upgrade.sql: sfcgal_upgrade.sql.in postgis_after_upgrade.sql
 	cat $^ > $@
 
 # SQL objects are also dependent on postgis_config.h for PostgreSQL version

Modified: trunk/postgis/postgis.sql.in
===================================================================
--- trunk/postgis/postgis.sql.in	2019-06-12 09:49:20 UTC (rev 17507)
+++ trunk/postgis/postgis.sql.in	2019-06-12 10:30:22 UTC (rev 17508)
@@ -3877,7 +3877,7 @@
 -- Availability: 1.2.2
 -- Changed but upgrader helper no touch: 2.4.0 marked parallel safe
 -- we don't want to force drop of this agg since its often used in views
--- parallel handling dealt with in postgis_drop_after.sql
+-- parallel handling dealt with in postgis_after_upgrade.sql
 -- Changed: 2.5.0 use 'internal' stype
 -- Changed: 3.0.0 transfn now converts to GEOS
 CREATE AGGREGATE ST_Union (geometry) (

Copied: trunk/postgis/postgis_after_upgrade.sql (from rev 17507, trunk/postgis/postgis_drop_after.sql)
===================================================================
--- trunk/postgis/postgis_after_upgrade.sql	                        (rev 0)
+++ trunk/postgis/postgis_after_upgrade.sql	2019-06-12 10:30:22 UTC (rev 17508)
@@ -0,0 +1,244 @@
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+--
+--
+-- PostGIS - Spatial Types for PostgreSQL
+-- http://postgis.net
+--
+-- Copyright (C) 2011-2012 Sandro Santilli <strk at kbt.io>
+-- Copyright (C) 2010-2012 Regina Obe <lr at pcorp.us>
+-- Copyright (C) 2009      Paul Ramsey <pramsey at cleverelephant.ca>
+--
+-- This is free software; you can redistribute and/or modify it under
+-- the terms of the GNU General Public Licence. See the COPYING file.
+--
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+--
+-- This file contains drop commands for obsoleted items that need
+-- to be dropped _after_ upgrade of old functions.
+-- Changes to this file affect postgis_upgrade*.sql script.
+--
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+-- First drop old aggregates
+DROP AGGREGATE IF EXISTS memgeomunion(geometry);
+DROP AGGREGATE IF EXISTS geomunion(geometry);
+DROP AGGREGATE IF EXISTS polygonize(geometry); -- Deprecated in 1.2.3, Dropped in 2.0.0
+DROP AGGREGATE IF EXISTS collect(geometry); -- Deprecated in 1.2.3, Dropped in 2.0.0
+DROP AGGREGATE IF EXISTS st_geomunion(geometry);
+DROP AGGREGATE IF EXISTS accum_old(geometry);
+DROP AGGREGATE IF EXISTS st_accum_old(geometry);
+DROP AGGREGATE IF EXISTS st_accum(geometry); -- Dropped in 3.0.0
+DROP FUNCTION IF EXISTS pgis_geometry_accum_finalfn(internal);
+
+DROP AGGREGATE IF EXISTS st_astwkb_agg(geometry, integer); -- temporarely introduced before 2.2.0 final
+DROP AGGREGATE IF EXISTS st_astwkb_agg(geometry, integer, bigint); -- temporarely introduced before 2.2.0 final
+DROP AGGREGATE IF EXISTS st_astwkbagg(geometry, integer); -- temporarely introduced before 2.2.0 final
+DROP AGGREGATE IF EXISTS st_astwkbagg(geometry, integer, bigint); -- temporarely introduced before 2.2.0 final
+DROP AGGREGATE IF EXISTS st_astwkbagg(geometry, integer, bigint, boolean); -- temporarely introduced before 2.2.0 final
+DROP AGGREGATE IF EXISTS st_astwkbagg(geometry, integer, bigint, boolean, boolean); -- temporarely introduced before 2.2.0 final
+
+-- BEGIN Management functions that now have default param for typmod --
+DROP FUNCTION IF EXISTS AddGeometryColumn(varchar, varchar, varchar, varchar, integer, varchar, integer);
+DROP FUNCTION IF EXISTS AddGeometryColumn(varchar, varchar, varchar, integer, varchar, integer);
+DROP FUNCTION IF EXISTS AddGeometryColumn(varchar, varchar, integer, varchar, integer);
+DROP FUNCTION IF EXISTS populate_geometry_columns();
+DROP FUNCTION IF EXISTS populate_geometry_columns(oid);
+
+-- END Management functions now have default parameter for typmod --
+-- Then drop old functions
+DROP FUNCTION IF EXISTS box2d_overleft(box2d, box2d);
+DROP FUNCTION IF EXISTS box2d_overright(box2d, box2d);
+DROP FUNCTION IF EXISTS box2d_left(box2d, box2d);
+DROP FUNCTION IF EXISTS box2d_right(box2d, box2d);
+DROP FUNCTION IF EXISTS box2d_contain(box2d, box2d);
+DROP FUNCTION IF EXISTS box2d_contained(box2d, box2d);
+DROP FUNCTION IF EXISTS box2d_overlap(box2d, box2d);
+DROP FUNCTION IF EXISTS box2d_same(box2d, box2d);
+DROP FUNCTION IF EXISTS box2d_intersects(box2d, box2d);
+DROP FUNCTION IF EXISTS st_area(geography); -- this one changed to use default parameters
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geometry); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geography); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geometry, int4); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geography, int4); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geometry); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geography); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geometry,int4); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geography,int4); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geography, int4, int4); -- dropped because the version-first signature is dumb
+DROP FUNCTION IF EXISTS _ST_AsGeoJson(int4, geometry, int4, int4); -- dropped in PostGIS-3.0 (r17300)
+DROP FUNCTION IF EXISTS _ST_AsGeoJson(int4, geography, int4, int4); -- dropped in PostGIS-3.0 (r17300)
+DROP FUNCTION IF EXISTS st_asgml(geometry); -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(geometry, int4);  -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(int4, geometry);  -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(int4, geometry, int4);  -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(int4, geometry, int4, int4);  -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(int4, geometry, int4, int4, text); -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(geography); -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(geography, int4);  -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(int4, geography);  -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(int4, geography, int4);  -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(int4, geography, int4, int4);  -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(int4, geography, int4, int4, text); -- changed to use default args
+DROP FUNCTION IF EXISTS _st_asgml(int4, geometry, int4, int4, text); -- changed to use default args
+DROP FUNCTION IF EXISTS _st_asgml(int4, geography, int4, int4, text); -- changed to use default args
+DROP FUNCTION IF EXISTS _st_asgml(int4, geography, int4, int4, text, text); -- changed to use default args
+DROP FUNCTION IF EXISTS st_asgml(geography, int4, int4);
+DROP FUNCTION IF EXISTS _st_askml(int4, geography, int4, text); -- dropped in PostGIS-3.0 (r17300)
+DROP FUNCTION IF EXISTS _st_askml(int4, geometry, int4, text); -- dropped in PostGIS-3.0 (r17300)
+DROP FUNCTION IF EXISTS st_askml(geometry); -- changed to use default args
+DROP FUNCTION IF EXISTS st_askml(geography); -- changed to use default args
+DROP FUNCTION IF EXISTS st_askml(int4, geometry, int4); -- changed to use default args
+DROP FUNCTION IF EXISTS st_askml(int4, geography, int4); -- changed to use default args
+DROP FUNCTION IF EXISTS st_askml(int4, geography, int4, text); -- dropped because the version-first signature is dumb
+
+DROP FUNCTION IF EXISTS st_asx3d(geometry); -- this one changed to use default parameters so full function deals with it
+DROP FUNCTION IF EXISTS st_asx3d(geometry, int4); -- introduce variant with opts so get rid of other without ops
+DROP FUNCTION IF EXISTS st_assvg(geometry); -- changed to use default args
+DROP FUNCTION IF EXISTS st_assvg(geometry, int4); -- changed to use default args
+DROP FUNCTION IF EXISTS st_assvg(geography); -- changed to use default args
+DROP FUNCTION IF EXISTS st_assvg(geography, int4); -- changed to use default args
+DROP FUNCTION IF EXISTS st_box2d_overleft(box2d, box2d);
+DROP FUNCTION IF EXISTS st_box2d_overright(box2d, box2d);
+DROP FUNCTION IF EXISTS st_box2d_left(box2d, box2d);
+DROP FUNCTION IF EXISTS st_box2d_right(box2d, box2d);
+DROP FUNCTION IF EXISTS st_box2d_contain(box2d, box2d);
+DROP FUNCTION IF EXISTS st_box2d_contained(box2d, box2d);
+DROP FUNCTION IF EXISTS st_box2d_overlap(box2d, box2d);
+DROP FUNCTION IF EXISTS st_box2d_same(box2d, box2d);
+DROP FUNCTION IF EXISTS st_box2d_intersects(box2d, box2d);
+DROP FUNCTION IF EXISTS st_box2d_in(cstring);
+DROP FUNCTION IF EXISTS st_box2d_out(box2d);
+DROP FUNCTION IF EXISTS st_box2d(geometry);
+DROP FUNCTION IF EXISTS st_box2d(box3d);
+DROP FUNCTION IF EXISTS st_box3d(box2d);
+DROP FUNCTION IF EXISTS st_box(box3d);
+DROP FUNCTION IF EXISTS st_box3d(geometry);
+DROP FUNCTION IF EXISTS st_box(geometry);
+DROP FUNCTION IF EXISTS _st_buffer(geometry, float8, cstring); -- dropped in PostGIS-3.0 (r17300)
+DROP FUNCTION IF EXISTS ST_ConcaveHull(geometry,float); -- this one changed to use default parameters
+DROP FUNCTION IF EXISTS ST_DWithin(geography, geography, float8); -- this one changed to use default parameters
+DROP FUNCTION IF EXISTS st_text(geometry);
+DROP FUNCTION IF EXISTS st_geometry(box2d);
+DROP FUNCTION IF EXISTS st_geometry(box3d);
+DROP FUNCTION IF EXISTS st_geometry(text);
+DROP FUNCTION IF EXISTS st_geometry(bytea);
+DROP FUNCTION IF EXISTS st_bytea(geometry);
+DROP FUNCTION IF EXISTS st_addbbox(geometry);
+DROP FUNCTION IF EXISTS _st_distance(geography, geography, float8, boolean); -- dropped in PostGIS-3.0 (r17300)
+DROP FUNCTION IF EXISTS st_dropbbox(geometry);
+DROP FUNCTION IF EXISTS st_hasbbox(geometry);
+DROP FUNCTION IF EXISTS cache_bbox();
+DROP FUNCTION IF EXISTS st_cache_bbox();
+DROP FUNCTION IF EXISTS ST_GeoHash(geometry); -- changed to use default args
+DROP FUNCTION IF EXISTS st_length(geography); -- this one changed to use default parameters
+DROP FUNCTION IF EXISTS st_perimeter(geography); -- this one changed to use default parameters
+DROP FUNCTION IF EXISTS transform_geometry(geometry, text, text, int);
+DROP FUNCTION IF EXISTS collector(geometry, geometry);
+DROP FUNCTION IF EXISTS st_collector(geometry, geometry);
+DROP FUNCTION IF EXISTS geom_accum (geometry[],geometry);
+DROP FUNCTION IF EXISTS st_geom_accum (geometry[],geometry);
+DROP FUNCTION IF EXISTS collect_garray (geometry[]);
+DROP FUNCTION IF EXISTS st_collect_garray (geometry[]);
+DROP FUNCTION IF EXISTS geosnoop(geometry);
+DROP FUNCTION IF EXISTS jtsnoop(geometry);
+DROP FUNCTION IF EXISTS st_noop(geometry);
+DROP FUNCTION IF EXISTS st_max_distance(geometry, geometry);
+DROP FUNCTION IF EXISTS  ST_MinimumBoundingCircle(geometry); --changed to use default parameters
+-- Drop internals that should never have existed --
+DROP FUNCTION IF EXISTS st_geometry_analyze(internal);
+DROP FUNCTION IF EXISTS st_geometry_in(cstring);
+DROP FUNCTION IF EXISTS st_geometry_out(geometry);
+DROP FUNCTION IF EXISTS st_geometry_recv(internal);
+DROP FUNCTION IF EXISTS st_geometry_send(geometry);
+DROP FUNCTION IF EXISTS st_spheroid_in(cstring);
+DROP FUNCTION IF EXISTS st_spheroid_out(spheroid);
+DROP FUNCTION IF EXISTS st_geometry_lt(geometry, geometry);
+DROP FUNCTION IF EXISTS st_geometry_gt(geometry, geometry);
+DROP FUNCTION IF EXISTS st_geometry_ge(geometry, geometry);
+DROP FUNCTION IF EXISTS st_geometry_eq(geometry, geometry);
+DROP FUNCTION IF EXISTS st_geometry_cmp(geometry, geometry);
+DROP FUNCTION IF EXISTS SnapToGrid(geometry, float8, float8);
+DROP FUNCTION IF EXISTS st_removerepeatedpoints(geometry);
+DROP FUNCTION IF EXISTS st_voronoi(geometry, geometry, double precision, boolean); --temporarely introduced before 2.3.0 final
+
+DROP FUNCTION IF EXISTS geometry_gist_sel_2d (internal, oid, internal, int4);
+DROP FUNCTION IF EXISTS geometry_gist_joinsel_2d(internal, oid, internal, smallint);
+DROP FUNCTION IF EXISTS geography_gist_selectivity (internal, oid, internal, int4);
+DROP FUNCTION IF EXISTS geography_gist_join_selectivity(internal, oid, internal, smallint);
+
+DROP FUNCTION IF EXISTS ST_AsBinary(text); -- deprecated in 2.0
+DROP FUNCTION IF EXISTS postgis_uses_stats(); -- deprecated in 2.0
+DROP FUNCTION IF EXISTS ST_GeneratePoints(geometry, numeric); -- numeric -> integer
+
+-- Old accum aggregate support type, removed in 2.5.0
+DROP TYPE IF EXISTS pgis_abs CASCADE;
+
+DROP FUNCTION IF EXISTS st_astwkb(geometry, integer, bigint, bool, bool); -- temporarely introduced before 2.2.0 final
+DROP FUNCTION IF EXISTS pgis_twkb_accum_transfn(internal, geometry, integer); -- temporarely introduced before 2.2.0 final
+DROP FUNCTION IF EXISTS pgis_twkb_accum_transfn(internal, geometry, integer, bigint); -- temporarely introduced before 2.2.0 final
+DROP FUNCTION IF EXISTS pgis_twkb_accum_transfn(internal, geometry, integer, bigint, bool); -- temporarely introduced before 2.2.0 final
+DROP FUNCTION IF EXISTS pgis_twkb_accum_transfn(internal, geometry, integer, bigint, bool, bool); -- temporarely introduced before 2.2.0 final
+DROP FUNCTION IF EXISTS pgis_twkb_accum_finalfn(internal); -- temporarely introduced before 2.2.0 final
+
+DROP FUNCTION IF EXISTS st_seteffectivearea(geometry, double precision); -- temporarely introduced before 2.2.0 final
+
+DROP FUNCTION IF EXISTS geometry_distance_box_nd(geometry, geometry); -- temporarely introduced before 2.2.0 final
+
+DROP FUNCTION IF EXISTS _ST_DumpPoints(geometry, integer[]); -- removed 2.4.0, but really should have been removed 2.1.0 when ST_DumpPoints got reimpmented in C
+
+-- Temporary clean-up while we wait to return these to action in dev
+DROP FUNCTION IF EXISTS _ST_DistanceRectTree(g1 geometry, g2 geometry);
+DROP FUNCTION IF EXISTS _ST_DistanceRectTreeCached(g1 geometry, g2 geometry);
+
+-- Deplicative signatures removed
+DROP FUNCTION IF EXISTS ST_Distance(geography, geography);
+DROP FUNCTION IF EXISTS ST_Distance(geography, geography, float8, boolean);
+DROP FUNCTION IF EXISTS ST_Buffer(geometry, float8, cstring);
+DROP FUNCTION IF EXISTS ST_IsValidDetail(geometry);
+DROP FUNCTION IF EXISTS ST_AsKML(int4, geometry, int4, text);
+DROP FUNCTION IF EXISTS ST_AsKML(geometry, int4);
+DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geometry, int4, int4);
+DROP FUNCTION IF EXISTS _ST_AsGeoJson(int4, geometry, int4, int4);
+
+-- Underscore_signatures removed for CamelCase
+DROP FUNCTION IF EXISTS st_shift_longitude(geometry);
+DROP FUNCTION IF EXISTS st_estimated_extent(text,text,text);
+DROP FUNCTION IF EXISTS st_estimated_extent(text,text);
+DROP FUNCTION IF EXISTS st_find_extent(text,text,text);
+DROP FUNCTION IF EXISTS st_find_extent(text,text);
+DROP FUNCTION IF EXISTS st_mem_size(geometry);
+DROP FUNCTION IF EXISTS st_3dlength_spheroid(geometry, spheroid);
+DROP FUNCTION IF EXISTS st_length_spheroid(geometry, spheroid);
+DROP FUNCTION IF EXISTS st_length2d_spheroid(geometry, spheroid);
+DROP FUNCTION IF EXISTS st_distance_spheroid(geometry, geometry, spheroid);
+DROP FUNCTION IF EXISTS st_point_inside_circle(geometry, float8, float8, float8);
+DROP FUNCTION IF EXISTS st_force_2d(geometry);
+DROP FUNCTION IF EXISTS st_force_3dz(geometry);
+DROP FUNCTION IF EXISTS st_force_3dm(geometry);
+DROP FUNCTION IF EXISTS st_force_collection(geometry);
+DROP FUNCTION IF EXISTS st_force_4d(geometry);
+DROP FUNCTION IF EXISTS st_force_3d(geometry);
+DROP FUNCTION IF EXISTS st_line_interpolate_point(geometry, float8);
+DROP FUNCTION IF EXISTS st_line_substring(geometry, float8, float8);
+DROP FUNCTION IF EXISTS st_line_locate_point(geometry, geometry);
+DROP FUNCTION IF EXISTS st_locate_between_measures(geometry, float8, float8);
+DROP FUNCTION IF EXISTS st_locate_along_measure(geometry, float8);
+DROP FUNCTION IF EXISTS st_combine_bbox(box3d, geometry);
+DROP FUNCTION IF EXISTS st_combine_bbox(box2d, geometry);
+DROP FUNCTION IF EXISTS st_distance_sphere(geometry, geometry);
+
+
+-- pgis_abs type was increased from 8 bytes in 2.1 to 16 bytes in 2.2
+-- See #3460
+UPDATE pg_type SET typlen=16 WHERE typname='pgis_abs' AND typlen=8;
+
+DO language 'plpgsql'
+$$
+BEGIN
+IF _postgis_scripts_pgsql_version()::integer >= 96 THEN
+-- mark ST_Union agg as parallel safe if it is not already
+	UPDATE pg_proc SET proparallel = 's'
+	WHERE oid = 'st_union(geometry)'::regprocedure AND proparallel = 'u';
+END IF;
+END;
+$$;

Copied: trunk/postgis/postgis_before_upgrade.sql (from rev 17507, trunk/postgis/postgis_drop_before.sql)
===================================================================
--- trunk/postgis/postgis_before_upgrade.sql	                        (rev 0)
+++ trunk/postgis/postgis_before_upgrade.sql	2019-06-12 10:30:22 UTC (rev 17508)
@@ -0,0 +1,234 @@
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+--
+--
+-- PostGIS - Spatial Types for PostgreSQL
+-- http://postgis.net
+--
+-- Copyright (C) 2011-2012 Sandro Santilli <strk at kbt.io>
+-- Copyright (C) 2010-2013 Regina Obe <lr at pcorp.us>
+-- Copyright (C) 2009      Paul Ramsey <pramsey at cleverelephant.ca>
+--
+-- This is free software; you can redistribute and/or modify it under
+-- the terms of the GNU General Public Licence. See the COPYING file.
+--
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+--
+-- This file contains drop commands for obsoleted items that need
+-- to be dropped _before_ upgrade of old functions.
+-- Changes to this file affect postgis_upgrade*.sql script.
+--
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+-- Helper function to drop functions when they match the full signature
+-- Requires schema, name and __identity_arguments__ as extracted from pg_catalog
+CREATE OR REPLACE FUNCTION _postgis_drop_function_if_needed(
+	function_schema text,
+	function_name text,
+	function_arguments text) RETURNS void AS $$
+DECLARE
+	frec RECORD;
+	sql_drop text;
+BEGIN
+	FOR frec IN
+		SELECT  p.oid as oid,
+				n.nspname as schema,
+				p.proname as name,
+				pg_catalog.pg_get_function_arguments(p.oid) as arguments,
+				pg_catalog.pg_get_function_identity_arguments(p.oid) as identity_arguments
+			FROM pg_catalog.pg_proc p
+			LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
+			WHERE
+				LOWER(n.nspname) = LOWER(function_schema) AND
+				LOWER(p.proname) = LOWER(function_name) AND
+				LOWER(pg_catalog.pg_get_function_arguments(p.oid)) ~ LOWER(function_arguments) AND
+				pg_catalog.pg_function_is_visible(p.oid)
+			ORDER BY 1, 2, 4
+	LOOP
+		sql_drop := 'DROP FUNCTION ' || quote_ident(frec.schema) || '.' || quote_ident(frec.name) || ' ( ' || frec.identity_arguments || ' ) ';
+		RAISE DEBUG 'Name (%): %', frec.oid, frec.name;
+		RAISE DEBUG 'Arguments: %', frec.arguments;
+		RAISE DEBUG 'Identity arguments: %', frec.identity_arguments;
+		RAISE DEBUG 'SQL query: %', sql_drop;
+		BEGIN
+			EXECUTE sql_drop;
+		EXCEPTION
+			WHEN OTHERS THEN
+				RAISE EXCEPTION 'Could not drop function %.%. You might need to drop dependant objects. Postgres error: %', function_schema, function_name, SQLERRM;
+		END;
+	END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+
+-- FUNCTION AddGeometryColumn signature dropped
+-- (catalog_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer, new_type character varying, new_dim integer, use_typmod boolean)
+SELECT _postgis_drop_function_if_needed
+	(
+	'@extschema@',
+	'AddGeometryColumn',
+	'catalog_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer, new_type character varying, new_dim integer, use_typmod boolean'
+	);
+
+-- FUNCTION ST_AsX3D was changed to add versioning for 2.0
+-- (geom geometry, prec integer, options integer)
+SELECT _postgis_drop_function_if_needed
+	(
+	'@extschema@',
+	'ST_AsX3D',
+	'geom geometry, prec integer, options integer'
+	);
+
+-- FUNCTION UpdateGeometrySRID changed the name of the args (http://trac.osgeo.org/postgis/ticket/1606) for 2.0
+-- It changed the paramenter `new_srid` to `new_srid_in`
+-- (catalogn_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer)
+-- Dropping it conditionally since the same signature still exists.
+SELECT _postgis_drop_function_if_needed
+	(
+	'@extschema@',
+	'UpdateGeometrySRID',
+	'catalogn_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer'
+	);
+
+
+--deprecated and removed in 2.1
+-- Hack to fix 2.0 naming
+-- We can't just drop it since its bound to opclass
+-- See ticket 2279 for why we need to do this
+-- We can get rid of this DO code when 3.0 comes along
+DO  language 'plpgsql' $$
+BEGIN
+	-- fix geometry ops --
+	IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprrest::text = 'geometry_gist_sel_2d') THEN
+	--it is bound to old name, drop new, rename old to new, install will fix body of code
+		DROP FUNCTION IF EXISTS gserialized_gist_sel_2d(internal, oid, internal, int4) ;
+		ALTER FUNCTION geometry_gist_sel_2d(internal, oid, internal, int4) RENAME TO gserialized_gist_sel_2d;
+	END IF;
+	IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprjoin::text = 'geometry_gist_joinsel_2d') THEN
+	--it is bound to old name, drop new, rename old to new,  install will fix body of code
+		DROP FUNCTION IF EXISTS gserialized_gist_joinsel_2d(internal, oid, internal, smallint) ;
+		ALTER FUNCTION geometry_gist_joinsel_2d(internal, oid, internal, smallint) RENAME TO gserialized_gist_joinsel_2d;
+	END IF;
+	-- fix geography ops --
+	IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprrest::text = 'geography_gist_selectivity') THEN
+	--it is bound to old name, drop new, rename old to new, install will fix body of code
+		DROP FUNCTION IF EXISTS gserialized_gist_sel_nd(internal, oid, internal, int4) ;
+		ALTER FUNCTION geography_gist_selectivity(internal, oid, internal, int4) RENAME TO gserialized_gist_sel_nd;
+	END IF;
+
+	IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprjoin::text = 'geography_gist_join_selectivity') THEN
+	--it is bound to old name, drop new, rename old to new, install will fix body of code
+		DROP FUNCTION IF EXISTS gserialized_gist_joinsel_nd(internal, oid, internal, smallint) ;
+		ALTER FUNCTION geography_gist_join_selectivity(internal, oid, internal, smallint) RENAME TO gserialized_gist_joinsel_nd;
+	END IF;
+END;
+$$ ;
+
+
+-- FUNCTION ST_AsLatLonText went from multiple signatures to a single one with defaults for 2.2.0
+DROP FUNCTION IF EXISTS ST_AsLatLonText(geometry); -- Does not conflict
+SELECT _postgis_drop_function_if_needed
+	(
+	'@extschema@',
+	'ST_AsLatLonText',
+	'geometry, text'
+	);
+
+
+-- FUNCTION _st_linecrossingdirection changed argument names in 3.0
+-- Was (geom1 geometry, geom2 geometry) and now (line1 geometry, line2 geometry)
+SELECT _postgis_drop_function_if_needed
+	(
+	'@extschema@',
+	'_st_linecrossingdirection',
+	'geom1 geometry, geom2 geometry'
+	);
+
+
+-- FUNCTION ST_LineCrossingDirection changed argument names in 3.0
+-- Was (geom1 geometry, geom2 geometry) and now (line1 geometry, line2 geometry)
+SELECT _postgis_drop_function_if_needed
+	(
+	'@extschema@',
+	'ST_LineCrossingDirection',
+	'geom1 geometry, geom2 geometry'
+	);
+
+
+-- FUNCTION _st_orderingequals changed argument names in 3.0
+-- Was (GeometryA geometry, GeometryB geometry) and now (geom1 geometry, geom2 geometry)
+SELECT _postgis_drop_function_if_needed
+	(
+	'@extschema@',
+	'_st_orderingequals',
+	'GeometryA geometry, GeometryB geometry'
+	);
+
+-- FUNCTION st_orderingequals changed argument names in 3.0
+-- Was (GeometryA geometry, GeometryB geometry) and now (geom1 geometry, geom2 geometry)
+SELECT _postgis_drop_function_if_needed
+	(
+	'@extschema@',
+	'st_orderingequals',
+	'GeometryA geometry, GeometryB geometry'
+	);
+
+
+-- FUNCTION st_askml changed to add defaults in 3.0 / r17357
+-- These signatures were superseeded
+DROP FUNCTION IF EXISTS st_askml(geometry, integer); -- Does not conflict
+DROP FUNCTION IF EXISTS st_askml(geography, integer); -- Does not conflict
+
+
+-- FUNCTION st_buffer changed to add defaults in 3.0
+-- This signature was superseeded
+DROP FUNCTION IF EXISTS st_buffer(geometry, double precision); -- Does not conflict
+
+
+-- FUNCTION ST_CurveToLine changed to add defaults in 2.5
+-- These signatures were superseeded
+DROP FUNCTION IF EXISTS ST_CurveToLine(geometry, integer); -- Does not conflict
+DROP FUNCTION IF EXISTS ST_CurveToLine(geometry); -- Does not conflict
+
+-- geometry_columns changed parameter types so we verify if it needs to be dropped
+-- We check the catalog to see if the view (geometry_columns) has a column
+-- with name `f_table_schema` and type `character varying(256)` as it was
+-- changed to type `name` in 2.2
+DO  language 'plpgsql' $$
+BEGIN
+	IF EXISTS
+		(
+			WITH oids AS
+			(
+				SELECT c.oid as oid,
+					n.nspname,
+					c.relname
+					FROM pg_catalog.pg_class c
+					LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
+					WHERE c.relname = 'geometry_columns' AND
+						n.nspname = 'public'
+					AND pg_catalog.pg_table_is_visible(c.oid)
+					ORDER BY 2, 3
+
+			),
+			name_attribute AS
+			(
+				SELECT  a.attname as attname,
+						pg_catalog.format_type(a.atttypid, a.atttypmod) as format_type
+						FROM pg_catalog.pg_attribute a, oids
+						WHERE a.attrelid = oids.oid AND a.attnum > 0 AND NOT a.attisdropped
+						ORDER BY a.attnum
+			)
+			SELECT attname, format_type
+			FROM name_attribute
+			WHERE attname = 'f_table_schema' AND format_type = 'character varying(256)'
+		)
+		THEN
+			DROP VIEW geometry_columns;
+		END IF;
+END;
+$$;
+
+
+-- DROP auxiliar function (created above)
+DROP FUNCTION _postgis_drop_function_if_needed(text, text, text);

Deleted: trunk/postgis/postgis_drop_after.sql
===================================================================
--- trunk/postgis/postgis_drop_after.sql	2019-06-12 09:49:20 UTC (rev 17507)
+++ trunk/postgis/postgis_drop_after.sql	2019-06-12 10:30:22 UTC (rev 17508)
@@ -1,244 +0,0 @@
--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---
---
--- PostGIS - Spatial Types for PostgreSQL
--- http://postgis.net
---
--- Copyright (C) 2011-2012 Sandro Santilli <strk at kbt.io>
--- Copyright (C) 2010-2012 Regina Obe <lr at pcorp.us>
--- Copyright (C) 2009      Paul Ramsey <pramsey at cleverelephant.ca>
---
--- This is free software; you can redistribute and/or modify it under
--- the terms of the GNU General Public Licence. See the COPYING file.
---
--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---
--- This file contains drop commands for obsoleted items that need
--- to be dropped _after_ upgrade of old functions.
--- Changes to this file affect postgis_upgrade*.sql script.
---
--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
--- First drop old aggregates
-DROP AGGREGATE IF EXISTS memgeomunion(geometry);
-DROP AGGREGATE IF EXISTS geomunion(geometry);
-DROP AGGREGATE IF EXISTS polygonize(geometry); -- Deprecated in 1.2.3, Dropped in 2.0.0
-DROP AGGREGATE IF EXISTS collect(geometry); -- Deprecated in 1.2.3, Dropped in 2.0.0
-DROP AGGREGATE IF EXISTS st_geomunion(geometry);
-DROP AGGREGATE IF EXISTS accum_old(geometry);
-DROP AGGREGATE IF EXISTS st_accum_old(geometry);
-DROP AGGREGATE IF EXISTS st_accum(geometry); -- Dropped in 3.0.0
-DROP FUNCTION IF EXISTS pgis_geometry_accum_finalfn(internal);
-
-DROP AGGREGATE IF EXISTS st_astwkb_agg(geometry, integer); -- temporarely introduced before 2.2.0 final
-DROP AGGREGATE IF EXISTS st_astwkb_agg(geometry, integer, bigint); -- temporarely introduced before 2.2.0 final
-DROP AGGREGATE IF EXISTS st_astwkbagg(geometry, integer); -- temporarely introduced before 2.2.0 final
-DROP AGGREGATE IF EXISTS st_astwkbagg(geometry, integer, bigint); -- temporarely introduced before 2.2.0 final
-DROP AGGREGATE IF EXISTS st_astwkbagg(geometry, integer, bigint, boolean); -- temporarely introduced before 2.2.0 final
-DROP AGGREGATE IF EXISTS st_astwkbagg(geometry, integer, bigint, boolean, boolean); -- temporarely introduced before 2.2.0 final
-
--- BEGIN Management functions that now have default param for typmod --
-DROP FUNCTION IF EXISTS AddGeometryColumn(varchar, varchar, varchar, varchar, integer, varchar, integer);
-DROP FUNCTION IF EXISTS AddGeometryColumn(varchar, varchar, varchar, integer, varchar, integer);
-DROP FUNCTION IF EXISTS AddGeometryColumn(varchar, varchar, integer, varchar, integer);
-DROP FUNCTION IF EXISTS populate_geometry_columns();
-DROP FUNCTION IF EXISTS populate_geometry_columns(oid);
-
--- END Management functions now have default parameter for typmod --
--- Then drop old functions
-DROP FUNCTION IF EXISTS box2d_overleft(box2d, box2d);
-DROP FUNCTION IF EXISTS box2d_overright(box2d, box2d);
-DROP FUNCTION IF EXISTS box2d_left(box2d, box2d);
-DROP FUNCTION IF EXISTS box2d_right(box2d, box2d);
-DROP FUNCTION IF EXISTS box2d_contain(box2d, box2d);
-DROP FUNCTION IF EXISTS box2d_contained(box2d, box2d);
-DROP FUNCTION IF EXISTS box2d_overlap(box2d, box2d);
-DROP FUNCTION IF EXISTS box2d_same(box2d, box2d);
-DROP FUNCTION IF EXISTS box2d_intersects(box2d, box2d);
-DROP FUNCTION IF EXISTS st_area(geography); -- this one changed to use default parameters
-DROP FUNCTION IF EXISTS ST_AsGeoJson(geometry); -- this one changed to use default args
-DROP FUNCTION IF EXISTS ST_AsGeoJson(geography); -- this one changed to use default args
-DROP FUNCTION IF EXISTS ST_AsGeoJson(geometry, int4); -- this one changed to use default args
-DROP FUNCTION IF EXISTS ST_AsGeoJson(geography, int4); -- this one changed to use default args
-DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geometry); -- this one changed to use default args
-DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geography); -- this one changed to use default args
-DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geometry,int4); -- this one changed to use default args
-DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geography,int4); -- this one changed to use default args
-DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geography, int4, int4); -- dropped because the version-first signature is dumb
-DROP FUNCTION IF EXISTS _ST_AsGeoJson(int4, geometry, int4, int4); -- dropped in PostGIS-3.0 (r17300)
-DROP FUNCTION IF EXISTS _ST_AsGeoJson(int4, geography, int4, int4); -- dropped in PostGIS-3.0 (r17300)
-DROP FUNCTION IF EXISTS st_asgml(geometry); -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(geometry, int4);  -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(int4, geometry);  -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(int4, geometry, int4);  -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(int4, geometry, int4, int4);  -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(int4, geometry, int4, int4, text); -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(geography); -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(geography, int4);  -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(int4, geography);  -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(int4, geography, int4);  -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(int4, geography, int4, int4);  -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(int4, geography, int4, int4, text); -- changed to use default args
-DROP FUNCTION IF EXISTS _st_asgml(int4, geometry, int4, int4, text); -- changed to use default args
-DROP FUNCTION IF EXISTS _st_asgml(int4, geography, int4, int4, text); -- changed to use default args
-DROP FUNCTION IF EXISTS _st_asgml(int4, geography, int4, int4, text, text); -- changed to use default args
-DROP FUNCTION IF EXISTS st_asgml(geography, int4, int4);
-DROP FUNCTION IF EXISTS _st_askml(int4, geography, int4, text); -- dropped in PostGIS-3.0 (r17300)
-DROP FUNCTION IF EXISTS _st_askml(int4, geometry, int4, text); -- dropped in PostGIS-3.0 (r17300)
-DROP FUNCTION IF EXISTS st_askml(geometry); -- changed to use default args
-DROP FUNCTION IF EXISTS st_askml(geography); -- changed to use default args
-DROP FUNCTION IF EXISTS st_askml(int4, geometry, int4); -- changed to use default args
-DROP FUNCTION IF EXISTS st_askml(int4, geography, int4); -- changed to use default args
-DROP FUNCTION IF EXISTS st_askml(int4, geography, int4, text); -- dropped because the version-first signature is dumb
-
-DROP FUNCTION IF EXISTS st_asx3d(geometry); -- this one changed to use default parameters so full function deals with it
-DROP FUNCTION IF EXISTS st_asx3d(geometry, int4); -- introduce variant with opts so get rid of other without ops
-DROP FUNCTION IF EXISTS st_assvg(geometry); -- changed to use default args
-DROP FUNCTION IF EXISTS st_assvg(geometry, int4); -- changed to use default args
-DROP FUNCTION IF EXISTS st_assvg(geography); -- changed to use default args
-DROP FUNCTION IF EXISTS st_assvg(geography, int4); -- changed to use default args
-DROP FUNCTION IF EXISTS st_box2d_overleft(box2d, box2d);
-DROP FUNCTION IF EXISTS st_box2d_overright(box2d, box2d);
-DROP FUNCTION IF EXISTS st_box2d_left(box2d, box2d);
-DROP FUNCTION IF EXISTS st_box2d_right(box2d, box2d);
-DROP FUNCTION IF EXISTS st_box2d_contain(box2d, box2d);
-DROP FUNCTION IF EXISTS st_box2d_contained(box2d, box2d);
-DROP FUNCTION IF EXISTS st_box2d_overlap(box2d, box2d);
-DROP FUNCTION IF EXISTS st_box2d_same(box2d, box2d);
-DROP FUNCTION IF EXISTS st_box2d_intersects(box2d, box2d);
-DROP FUNCTION IF EXISTS st_box2d_in(cstring);
-DROP FUNCTION IF EXISTS st_box2d_out(box2d);
-DROP FUNCTION IF EXISTS st_box2d(geometry);
-DROP FUNCTION IF EXISTS st_box2d(box3d);
-DROP FUNCTION IF EXISTS st_box3d(box2d);
-DROP FUNCTION IF EXISTS st_box(box3d);
-DROP FUNCTION IF EXISTS st_box3d(geometry);
-DROP FUNCTION IF EXISTS st_box(geometry);
-DROP FUNCTION IF EXISTS _st_buffer(geometry, float8, cstring); -- dropped in PostGIS-3.0 (r17300)
-DROP FUNCTION IF EXISTS ST_ConcaveHull(geometry,float); -- this one changed to use default parameters
-DROP FUNCTION IF EXISTS ST_DWithin(geography, geography, float8); -- this one changed to use default parameters
-DROP FUNCTION IF EXISTS st_text(geometry);
-DROP FUNCTION IF EXISTS st_geometry(box2d);
-DROP FUNCTION IF EXISTS st_geometry(box3d);
-DROP FUNCTION IF EXISTS st_geometry(text);
-DROP FUNCTION IF EXISTS st_geometry(bytea);
-DROP FUNCTION IF EXISTS st_bytea(geometry);
-DROP FUNCTION IF EXISTS st_addbbox(geometry);
-DROP FUNCTION IF EXISTS _st_distance(geography, geography, float8, boolean); -- dropped in PostGIS-3.0 (r17300)
-DROP FUNCTION IF EXISTS st_dropbbox(geometry);
-DROP FUNCTION IF EXISTS st_hasbbox(geometry);
-DROP FUNCTION IF EXISTS cache_bbox();
-DROP FUNCTION IF EXISTS st_cache_bbox();
-DROP FUNCTION IF EXISTS ST_GeoHash(geometry); -- changed to use default args
-DROP FUNCTION IF EXISTS st_length(geography); -- this one changed to use default parameters
-DROP FUNCTION IF EXISTS st_perimeter(geography); -- this one changed to use default parameters
-DROP FUNCTION IF EXISTS transform_geometry(geometry, text, text, int);
-DROP FUNCTION IF EXISTS collector(geometry, geometry);
-DROP FUNCTION IF EXISTS st_collector(geometry, geometry);
-DROP FUNCTION IF EXISTS geom_accum (geometry[],geometry);
-DROP FUNCTION IF EXISTS st_geom_accum (geometry[],geometry);
-DROP FUNCTION IF EXISTS collect_garray (geometry[]);
-DROP FUNCTION IF EXISTS st_collect_garray (geometry[]);
-DROP FUNCTION IF EXISTS geosnoop(geometry);
-DROP FUNCTION IF EXISTS jtsnoop(geometry);
-DROP FUNCTION IF EXISTS st_noop(geometry);
-DROP FUNCTION IF EXISTS st_max_distance(geometry, geometry);
-DROP FUNCTION IF EXISTS  ST_MinimumBoundingCircle(geometry); --changed to use default parameters
--- Drop internals that should never have existed --
-DROP FUNCTION IF EXISTS st_geometry_analyze(internal);
-DROP FUNCTION IF EXISTS st_geometry_in(cstring);
-DROP FUNCTION IF EXISTS st_geometry_out(geometry);
-DROP FUNCTION IF EXISTS st_geometry_recv(internal);
-DROP FUNCTION IF EXISTS st_geometry_send(geometry);
-DROP FUNCTION IF EXISTS st_spheroid_in(cstring);
-DROP FUNCTION IF EXISTS st_spheroid_out(spheroid);
-DROP FUNCTION IF EXISTS st_geometry_lt(geometry, geometry);
-DROP FUNCTION IF EXISTS st_geometry_gt(geometry, geometry);
-DROP FUNCTION IF EXISTS st_geometry_ge(geometry, geometry);
-DROP FUNCTION IF EXISTS st_geometry_eq(geometry, geometry);
-DROP FUNCTION IF EXISTS st_geometry_cmp(geometry, geometry);
-DROP FUNCTION IF EXISTS SnapToGrid(geometry, float8, float8);
-DROP FUNCTION IF EXISTS st_removerepeatedpoints(geometry);
-DROP FUNCTION IF EXISTS st_voronoi(geometry, geometry, double precision, boolean); --temporarely introduced before 2.3.0 final
-
-DROP FUNCTION IF EXISTS geometry_gist_sel_2d (internal, oid, internal, int4);
-DROP FUNCTION IF EXISTS geometry_gist_joinsel_2d(internal, oid, internal, smallint);
-DROP FUNCTION IF EXISTS geography_gist_selectivity (internal, oid, internal, int4);
-DROP FUNCTION IF EXISTS geography_gist_join_selectivity(internal, oid, internal, smallint);
-
-DROP FUNCTION IF EXISTS ST_AsBinary(text); -- deprecated in 2.0
-DROP FUNCTION IF EXISTS postgis_uses_stats(); -- deprecated in 2.0
-DROP FUNCTION IF EXISTS ST_GeneratePoints(geometry, numeric); -- numeric -> integer
-
--- Old accum aggregate support type, removed in 2.5.0
-DROP TYPE IF EXISTS pgis_abs CASCADE;
-
-DROP FUNCTION IF EXISTS st_astwkb(geometry, integer, bigint, bool, bool); -- temporarely introduced before 2.2.0 final
-DROP FUNCTION IF EXISTS pgis_twkb_accum_transfn(internal, geometry, integer); -- temporarely introduced before 2.2.0 final
-DROP FUNCTION IF EXISTS pgis_twkb_accum_transfn(internal, geometry, integer, bigint); -- temporarely introduced before 2.2.0 final
-DROP FUNCTION IF EXISTS pgis_twkb_accum_transfn(internal, geometry, integer, bigint, bool); -- temporarely introduced before 2.2.0 final
-DROP FUNCTION IF EXISTS pgis_twkb_accum_transfn(internal, geometry, integer, bigint, bool, bool); -- temporarely introduced before 2.2.0 final
-DROP FUNCTION IF EXISTS pgis_twkb_accum_finalfn(internal); -- temporarely introduced before 2.2.0 final
-
-DROP FUNCTION IF EXISTS st_seteffectivearea(geometry, double precision); -- temporarely introduced before 2.2.0 final
-
-DROP FUNCTION IF EXISTS geometry_distance_box_nd(geometry, geometry); -- temporarely introduced before 2.2.0 final
-
-DROP FUNCTION IF EXISTS _ST_DumpPoints(geometry, integer[]); -- removed 2.4.0, but really should have been removed 2.1.0 when ST_DumpPoints got reimpmented in C
-
--- Temporary clean-up while we wait to return these to action in dev
-DROP FUNCTION IF EXISTS _ST_DistanceRectTree(g1 geometry, g2 geometry);
-DROP FUNCTION IF EXISTS _ST_DistanceRectTreeCached(g1 geometry, g2 geometry);
-
--- Deplicative signatures removed
-DROP FUNCTION IF EXISTS ST_Distance(geography, geography);
-DROP FUNCTION IF EXISTS ST_Distance(geography, geography, float8, boolean);
-DROP FUNCTION IF EXISTS ST_Buffer(geometry, float8, cstring);
-DROP FUNCTION IF EXISTS ST_IsValidDetail(geometry);
-DROP FUNCTION IF EXISTS ST_AsKML(int4, geometry, int4, text);
-DROP FUNCTION IF EXISTS ST_AsKML(geometry, int4);
-DROP FUNCTION IF EXISTS ST_AsGeoJson(int4, geometry, int4, int4);
-DROP FUNCTION IF EXISTS _ST_AsGeoJson(int4, geometry, int4, int4);
-
--- Underscore_signatures removed for CamelCase
-DROP FUNCTION IF EXISTS st_shift_longitude(geometry);
-DROP FUNCTION IF EXISTS st_estimated_extent(text,text,text);
-DROP FUNCTION IF EXISTS st_estimated_extent(text,text);
-DROP FUNCTION IF EXISTS st_find_extent(text,text,text);
-DROP FUNCTION IF EXISTS st_find_extent(text,text);
-DROP FUNCTION IF EXISTS st_mem_size(geometry);
-DROP FUNCTION IF EXISTS st_3dlength_spheroid(geometry, spheroid);
-DROP FUNCTION IF EXISTS st_length_spheroid(geometry, spheroid);
-DROP FUNCTION IF EXISTS st_length2d_spheroid(geometry, spheroid);
-DROP FUNCTION IF EXISTS st_distance_spheroid(geometry, geometry, spheroid);
-DROP FUNCTION IF EXISTS st_point_inside_circle(geometry, float8, float8, float8);
-DROP FUNCTION IF EXISTS st_force_2d(geometry);
-DROP FUNCTION IF EXISTS st_force_3dz(geometry);
-DROP FUNCTION IF EXISTS st_force_3dm(geometry);
-DROP FUNCTION IF EXISTS st_force_collection(geometry);
-DROP FUNCTION IF EXISTS st_force_4d(geometry);
-DROP FUNCTION IF EXISTS st_force_3d(geometry);
-DROP FUNCTION IF EXISTS st_line_interpolate_point(geometry, float8);
-DROP FUNCTION IF EXISTS st_line_substring(geometry, float8, float8);
-DROP FUNCTION IF EXISTS st_line_locate_point(geometry, geometry);
-DROP FUNCTION IF EXISTS st_locate_between_measures(geometry, float8, float8);
-DROP FUNCTION IF EXISTS st_locate_along_measure(geometry, float8);
-DROP FUNCTION IF EXISTS st_combine_bbox(box3d, geometry);
-DROP FUNCTION IF EXISTS st_combine_bbox(box2d, geometry);
-DROP FUNCTION IF EXISTS st_distance_sphere(geometry, geometry);
-
-
--- pgis_abs type was increased from 8 bytes in 2.1 to 16 bytes in 2.2
--- See #3460
-UPDATE pg_type SET typlen=16 WHERE typname='pgis_abs' AND typlen=8;
-
-DO language 'plpgsql'
-$$
-BEGIN
-IF _postgis_scripts_pgsql_version()::integer >= 96 THEN
--- mark ST_Union agg as parallel safe if it is not already
-	UPDATE pg_proc SET proparallel = 's'
-	WHERE oid = 'st_union(geometry)'::regprocedure AND proparallel = 'u';
-END IF;
-END;
-$$;

Deleted: trunk/postgis/postgis_drop_before.sql
===================================================================
--- trunk/postgis/postgis_drop_before.sql	2019-06-12 09:49:20 UTC (rev 17507)
+++ trunk/postgis/postgis_drop_before.sql	2019-06-12 10:30:22 UTC (rev 17508)
@@ -1,234 +0,0 @@
--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---
---
--- PostGIS - Spatial Types for PostgreSQL
--- http://postgis.net
---
--- Copyright (C) 2011-2012 Sandro Santilli <strk at kbt.io>
--- Copyright (C) 2010-2013 Regina Obe <lr at pcorp.us>
--- Copyright (C) 2009      Paul Ramsey <pramsey at cleverelephant.ca>
---
--- This is free software; you can redistribute and/or modify it under
--- the terms of the GNU General Public Licence. See the COPYING file.
---
--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---
--- This file contains drop commands for obsoleted items that need
--- to be dropped _before_ upgrade of old functions.
--- Changes to this file affect postgis_upgrade*.sql script.
---
--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
--- Helper function to drop functions when they match the full signature
--- Requires schema, name and __identity_arguments__ as extracted from pg_catalog
-CREATE OR REPLACE FUNCTION _postgis_drop_function_if_needed(
-	function_schema text,
-	function_name text,
-	function_arguments text) RETURNS void AS $$
-DECLARE
-	frec RECORD;
-	sql_drop text;
-BEGIN
-	FOR frec IN
-		SELECT  p.oid as oid,
-				n.nspname as schema,
-				p.proname as name,
-				pg_catalog.pg_get_function_arguments(p.oid) as arguments,
-				pg_catalog.pg_get_function_identity_arguments(p.oid) as identity_arguments
-			FROM pg_catalog.pg_proc p
-			LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
-			WHERE
-				LOWER(n.nspname) = LOWER(function_schema) AND
-				LOWER(p.proname) = LOWER(function_name) AND
-				LOWER(pg_catalog.pg_get_function_arguments(p.oid)) ~ LOWER(function_arguments) AND
-				pg_catalog.pg_function_is_visible(p.oid)
-			ORDER BY 1, 2, 4
-	LOOP
-		sql_drop := 'DROP FUNCTION ' || quote_ident(frec.schema) || '.' || quote_ident(frec.name) || ' ( ' || frec.identity_arguments || ' ) ';
-		RAISE DEBUG 'Name (%): %', frec.oid, frec.name;
-		RAISE DEBUG 'Arguments: %', frec.arguments;
-		RAISE DEBUG 'Identity arguments: %', frec.identity_arguments;
-		RAISE DEBUG 'SQL query: %', sql_drop;
-		BEGIN
-			EXECUTE sql_drop;
-		EXCEPTION
-			WHEN OTHERS THEN
-				RAISE EXCEPTION 'Could not drop function %.%. You might need to drop dependant objects. Postgres error: %', function_schema, function_name, SQLERRM;
-		END;
-	END LOOP;
-END;
-$$ LANGUAGE plpgsql;
-
-
--- FUNCTION AddGeometryColumn signature dropped
--- (catalog_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer, new_type character varying, new_dim integer, use_typmod boolean)
-SELECT _postgis_drop_function_if_needed
-	(
-	'@extschema@',
-	'AddGeometryColumn',
-	'catalog_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer, new_type character varying, new_dim integer, use_typmod boolean'
-	);
-
--- FUNCTION ST_AsX3D was changed to add versioning for 2.0
--- (geom geometry, prec integer, options integer)
-SELECT _postgis_drop_function_if_needed
-	(
-	'@extschema@',
-	'ST_AsX3D',
-	'geom geometry, prec integer, options integer'
-	);
-
--- FUNCTION UpdateGeometrySRID changed the name of the args (http://trac.osgeo.org/postgis/ticket/1606) for 2.0
--- It changed the paramenter `new_srid` to `new_srid_in`
--- (catalogn_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer)
--- Dropping it conditionally since the same signature still exists.
-SELECT _postgis_drop_function_if_needed
-	(
-	'@extschema@',
-	'UpdateGeometrySRID',
-	'catalogn_name character varying, schema_name character varying, table_name character varying, column_name character varying, new_srid integer'
-	);
-
-
---deprecated and removed in 2.1
--- Hack to fix 2.0 naming
--- We can't just drop it since its bound to opclass
--- See ticket 2279 for why we need to do this
--- We can get rid of this DO code when 3.0 comes along
-DO  language 'plpgsql' $$
-BEGIN
-	-- fix geometry ops --
-	IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprrest::text = 'geometry_gist_sel_2d') THEN
-	--it is bound to old name, drop new, rename old to new, install will fix body of code
-		DROP FUNCTION IF EXISTS gserialized_gist_sel_2d(internal, oid, internal, int4) ;
-		ALTER FUNCTION geometry_gist_sel_2d(internal, oid, internal, int4) RENAME TO gserialized_gist_sel_2d;
-	END IF;
-	IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprjoin::text = 'geometry_gist_joinsel_2d') THEN
-	--it is bound to old name, drop new, rename old to new,  install will fix body of code
-		DROP FUNCTION IF EXISTS gserialized_gist_joinsel_2d(internal, oid, internal, smallint) ;
-		ALTER FUNCTION geometry_gist_joinsel_2d(internal, oid, internal, smallint) RENAME TO gserialized_gist_joinsel_2d;
-	END IF;
-	-- fix geography ops --
-	IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprrest::text = 'geography_gist_selectivity') THEN
-	--it is bound to old name, drop new, rename old to new, install will fix body of code
-		DROP FUNCTION IF EXISTS gserialized_gist_sel_nd(internal, oid, internal, int4) ;
-		ALTER FUNCTION geography_gist_selectivity(internal, oid, internal, int4) RENAME TO gserialized_gist_sel_nd;
-	END IF;
-
-	IF EXISTS(SELECT oprname from pg_operator where oprname = '&&' AND oprjoin::text = 'geography_gist_join_selectivity') THEN
-	--it is bound to old name, drop new, rename old to new, install will fix body of code
-		DROP FUNCTION IF EXISTS gserialized_gist_joinsel_nd(internal, oid, internal, smallint) ;
-		ALTER FUNCTION geography_gist_join_selectivity(internal, oid, internal, smallint) RENAME TO gserialized_gist_joinsel_nd;
-	END IF;
-END;
-$$ ;
-
-
--- FUNCTION ST_AsLatLonText went from multiple signatures to a single one with defaults for 2.2.0
-DROP FUNCTION IF EXISTS ST_AsLatLonText(geometry); -- Does not conflict
-SELECT _postgis_drop_function_if_needed
-	(
-	'@extschema@',
-	'ST_AsLatLonText',
-	'geometry, text'
-	);
-
-
--- FUNCTION _st_linecrossingdirection changed argument names in 3.0
--- Was (geom1 geometry, geom2 geometry) and now (line1 geometry, line2 geometry)
-SELECT _postgis_drop_function_if_needed
-	(
-	'@extschema@',
-	'_st_linecrossingdirection',
-	'geom1 geometry, geom2 geometry'
-	);
-
-
--- FUNCTION ST_LineCrossingDirection changed argument names in 3.0
--- Was (geom1 geometry, geom2 geometry) and now (line1 geometry, line2 geometry)
-SELECT _postgis_drop_function_if_needed
-	(
-	'@extschema@',
-	'ST_LineCrossingDirection',
-	'geom1 geometry, geom2 geometry'
-	);
-
-
--- FUNCTION _st_orderingequals changed argument names in 3.0
--- Was (GeometryA geometry, GeometryB geometry) and now (geom1 geometry, geom2 geometry)
-SELECT _postgis_drop_function_if_needed
-	(
-	'@extschema@',
-	'_st_orderingequals',
-	'GeometryA geometry, GeometryB geometry'
-	);
-
--- FUNCTION st_orderingequals changed argument names in 3.0
--- Was (GeometryA geometry, GeometryB geometry) and now (geom1 geometry, geom2 geometry)
-SELECT _postgis_drop_function_if_needed
-	(
-	'@extschema@',
-	'st_orderingequals',
-	'GeometryA geometry, GeometryB geometry'
-	);
-
-
--- FUNCTION st_askml changed to add defaults in 3.0 / r17357
--- These signatures were superseeded
-DROP FUNCTION IF EXISTS st_askml(geometry, integer); -- Does not conflict
-DROP FUNCTION IF EXISTS st_askml(geography, integer); -- Does not conflict
-
-
--- FUNCTION st_buffer changed to add defaults in 3.0
--- This signature was superseeded
-DROP FUNCTION IF EXISTS st_buffer(geometry, double precision); -- Does not conflict
-
-
--- FUNCTION ST_CurveToLine changed to add defaults in 2.5
--- These signatures were superseeded
-DROP FUNCTION IF EXISTS ST_CurveToLine(geometry, integer); -- Does not conflict
-DROP FUNCTION IF EXISTS ST_CurveToLine(geometry); -- Does not conflict
-
--- geometry_columns changed parameter types so we verify if it needs to be dropped
--- We check the catalog to see if the view (geometry_columns) has a column
--- with name `f_table_schema` and type `character varying(256)` as it was
--- changed to type `name` in 2.2
-DO  language 'plpgsql' $$
-BEGIN
-	IF EXISTS
-		(
-			WITH oids AS
-			(
-				SELECT c.oid as oid,
-					n.nspname,
-					c.relname
-					FROM pg_catalog.pg_class c
-					LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
-					WHERE c.relname = 'geometry_columns' AND
-						n.nspname = 'public'
-					AND pg_catalog.pg_table_is_visible(c.oid)
-					ORDER BY 2, 3
-
-			),
-			name_attribute AS
-			(
-				SELECT  a.attname as attname,
-						pg_catalog.format_type(a.atttypid, a.atttypmod) as format_type
-						FROM pg_catalog.pg_attribute a, oids
-						WHERE a.attrelid = oids.oid AND a.attnum > 0 AND NOT a.attisdropped
-						ORDER BY a.attnum
-			)
-			SELECT attname, format_type
-			FROM name_attribute
-			WHERE attname = 'f_table_schema' AND format_type = 'character varying(256)'
-		)
-		THEN
-			DROP VIEW geometry_columns;
-		END IF;
-END;
-$$;
-
-
--- DROP auxiliar function (created above)
-DROP FUNCTION _postgis_drop_function_if_needed(text, text, text);

Modified: trunk/utils/Makefile.in
===================================================================
--- trunk/utils/Makefile.in	2019-06-12 09:49:20 UTC (rev 17507)
+++ trunk/utils/Makefile.in	2019-06-12 10:30:22 UTC (rev 17508)
@@ -47,8 +47,8 @@
 DROP_FILES = \
   ../raster/rt_pg/rtpostgis_upgrade_cleanup.sql.in \
   ../raster/rt_pg/rtpostgis_drop.sql.in \
-  ../postgis/postgis_drop_after.sql \
-  ../postgis/postgis_drop_before.sql
+  ../postgis/postgis_after_upgrade.sql \
+  ../postgis/postgis_before_upgrade.sql
 
 update-restore:
 	tac postgis_restore.pl.in | sed '/^__END__/q' | grep -v '^__END__' \



More information about the postgis-tickets mailing list