[postgis-tickets] r17060 - Add 2.2.8 to upgrade targets

Regina Obe lr at pcorp.us
Thu Nov 22 01:10:51 PST 2018


Author: robe
Date: 2018-11-22 13:10:50 -0800 (Thu, 22 Nov 2018)
New Revision: 17060

Modified:
   branches/2.5/NEWS
   branches/2.5/extensions/upgradeable_versions.mk
   branches/2.5/postgis/postgis.sql.in
   branches/2.5/raster/rt_pg/rtpostgis.sql.in
   branches/2.5/topology/topology.sql.in
Log:
Add 2.2.8 to upgrade targets
Remove using of pg_constraint.consrc to allow support of 12 as noted by Laurenz Albe (pg_constraint.consrc was removed in 12devel)
Closes #4231 for postgis 2.5.2

Modified: branches/2.5/NEWS
===================================================================
--- branches/2.5/NEWS	2018-11-22 16:18:14 UTC (rev 17059)
+++ branches/2.5/NEWS	2018-11-22 21:10:50 UTC (rev 17060)
@@ -2,6 +2,8 @@
 XXXX/XX/XX
 
  * Bug fixes *
+  - #4231, Support for PostgreSQL 12dev (remove use of pg_constraint.consrc)
+           (Regina Obe, Laurenz Albe)
   - #4247, Avoid undefined behaviour in next_float functions (Raúl Marín)
   - #4249, Fix undefined behaviour in raster intersection (Raúl Marín)
   - #4246, Fix undefined behaviour in ST_3DDistance (Raúl Marín)

Modified: branches/2.5/extensions/upgradeable_versions.mk
===================================================================
--- branches/2.5/extensions/upgradeable_versions.mk	2018-11-22 16:18:14 UTC (rev 17059)
+++ branches/2.5/extensions/upgradeable_versions.mk	2018-11-22 21:10:50 UTC (rev 17060)
@@ -25,6 +25,7 @@
 	2.2.5 \
 	2.2.6 \
 	2.2.7 \
+	2.2.8 \
 	2.3.0 \
 	2.3.1 \
 	2.3.2 \

Modified: branches/2.5/postgis/postgis.sql.in
===================================================================
--- branches/2.5/postgis/postgis.sql.in	2018-11-22 16:18:14 UTC (rev 17059)
+++ branches/2.5/postgis/postgis.sql.in	2018-11-22 21:10:50 UTC (rev 17060)
@@ -5554,11 +5554,14 @@
 LANGUAGE 'sql' STABLE STRICT _PARALLEL;
 
 -- Availability: 2.0.0
--- Deprecation in 2.2.0
+-- Undeprecated 2.5.2 needed by UpdateGeometrySRID
 CREATE OR REPLACE FUNCTION postgis_constraint_dims(geomschema text, geomtable text, geomcolumn text) RETURNS integer AS
 $$
 SELECT  replace(split_part(s.consrc, ' = ', 2), ')', '')::integer
-		 FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+
+		 FROM pg_class c, pg_namespace n, pg_attribute a
+		 , (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+		    FROM pg_constraint) AS s
 		 WHERE n.nspname = $1
 		 AND c.relname = $2
 		 AND a.attname = $3
@@ -5573,11 +5576,15 @@
 -- support function to pull out geometry type from constraint check
 -- will return pretty name instead of ugly name
 -- Availability: 2.0.0
--- Deprecation in 2.2.0
+-- Undeprecated
+-- Changed: 2.5.2 replace use of pg_constraint.consrc with pg_get_constraintdef, consrc removed pg12
 CREATE OR REPLACE FUNCTION postgis_constraint_type(geomschema text, geomtable text, geomcolumn text) RETURNS varchar AS
 $$
 SELECT  replace(split_part(s.consrc, '''', 2), ')', '')::varchar
-		 FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+
+		 FROM pg_class c, pg_namespace n, pg_attribute a
+		 , (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+		    FROM pg_constraint) AS s
 		 WHERE n.nspname = $1
 		 AND c.relname = $2
 		 AND a.attname = $3
@@ -5593,6 +5600,7 @@
 -- Changed: 2.1.8 significant performance improvement for constraint based columns
 -- Changed: 2.2.0 get rid of schema, table, column cast to improve performance
 -- Changed: 2.4.0 List also Parent partitioned tables
+-- Changed: 2.5.2 replace use of pg_constraint.consrc with pg_get_constraintdef, consrc removed pg12
 CREATE OR REPLACE VIEW geometry_columns AS
  SELECT current_database()::character varying(256) AS f_table_catalog,
     n.nspname AS f_table_schema,
@@ -5608,7 +5616,8 @@
      LEFT JOIN ( SELECT s.connamespace,
             s.conrelid,
             s.conkey, replace(split_part(s.consrc, ''''::text, 2), ')'::text, ''::text) As type
-           FROM pg_constraint AS s
+           FROM (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+				FROM pg_constraint) AS s
           WHERE s.consrc ~~* '%geometrytype(% = %'::text
 
 ) st ON st.connamespace = n.oid AND st.conrelid = c.oid AND (a.attnum = ANY (st.conkey))
@@ -5615,7 +5624,8 @@
      LEFT JOIN ( SELECT s.connamespace,
             s.conrelid,
             s.conkey, replace(split_part(s.consrc, ' = '::text, 2), ')'::text, ''::text)::integer As ndims
-           FROM pg_constraint AS s
+           FROM (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+		    FROM pg_constraint) AS s
           WHERE s.consrc ~~* '%ndims(% = %'::text
 
 ) sn ON sn.connamespace = n.oid AND sn.conrelid = c.oid AND (a.attnum = ANY (sn.conkey))
@@ -5622,7 +5632,8 @@
      LEFT JOIN ( SELECT s.connamespace,
             s.conrelid,
             s.conkey, replace(replace(split_part(s.consrc, ' = '::text, 2), ')'::text, ''::text), '('::text, ''::text)::integer As srid
-           FROM pg_constraint AS s
+           FROM (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+		    FROM pg_constraint) AS s
           WHERE s.consrc ~~* '%srid(% = %'::text
 
 ) sr ON sr.connamespace = n.oid AND sr.conrelid = c.oid AND (a.attnum = ANY (sr.conkey))

Modified: branches/2.5/raster/rt_pg/rtpostgis.sql.in
===================================================================
--- branches/2.5/raster/rt_pg/rtpostgis.sql.in	2018-11-22 16:18:14 UTC (rev 17059)
+++ branches/2.5/raster/rt_pg/rtpostgis.sql.in	2018-11-22 21:10:50 UTC (rev 17060)
@@ -7210,7 +7210,9 @@
 			split_part(s.consrc, ' = ', 2),
 			'[\(\)]', '', 'g'
 		)::integer
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+		    FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -7280,7 +7282,9 @@
 			),
 			'[ ''''\(\)]', '', 'g'
 		)::text AS val
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -7366,7 +7370,9 @@
 					'[\(\)]', '', 'g'
 				)::integer
 			END
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -7442,7 +7448,9 @@
 	RETURNS geometry AS $$
 	SELECT
 		trim(both '''' from split_part(trim(split_part(s.consrc, ' @ ', 2)), '::', 1))::geometry
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -7504,7 +7512,9 @@
 	RETURNS boolean AS $$
 	SELECT
 		TRUE
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -7545,7 +7555,7 @@
 
 		sql := 'ALTER TABLE ' || fqtn ||
 			' ADD CONSTRAINT ' || quote_ident(cn) ||
-			' CHECK (st_samealignment(' || quote_ident($3) || ', ''' || attr || '''::raster))';
+			' CHECK (@extschema at .st_samealignment(' || quote_ident($3) || ', ''' || attr || '''::raster))';
 		RETURN  @extschema at ._add_raster_constraint(cn, sql);
 	END;
 	$$ LANGUAGE 'plpgsql' VOLATILE STRICT
@@ -7561,7 +7571,10 @@
 	RETURNS boolean AS $$
 	SELECT
 		TRUE
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s, pg_index idx, pg_operator op
+	FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conrelid, conindid, conkey, contype, conexclop, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
+		, pg_index idx, pg_operator op
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -7609,7 +7622,10 @@
 	BEGIN
 		SELECT
 			s.conname INTO cn
-		FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s, pg_index idx, pg_operator op
+		FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conname, conrelid, conkey, conindid, contype, conexclop, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
+		, pg_index idx, pg_operator op
 		WHERE n.nspname = $1
 			AND c.relname = $2
 			AND a.attname = $3
@@ -7632,7 +7648,9 @@
 	RETURNS boolean AS $$
 	SELECT
 		TRUE
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+			, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -7743,7 +7761,9 @@
 			split_part(s.consrc, ' = ', 2),
 			'[\(\)]', '', 'g'
 		)::integer
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -7810,7 +7830,9 @@
 				'::', 1
 			)
 		)::text[]
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -7893,7 +7915,9 @@
 				'::', 1
 			)
 		)::double precision[]
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -7982,7 +8006,9 @@
 				'::', 1
 			)
 		)::boolean[]
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+			, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -8624,7 +8650,9 @@
 		split_part(split_part(s.consrc, '''::name', 2), '''', 2)::name,
 		split_part(split_part(s.consrc, '''::name', 3), '''', 2)::name,
 		trim(both from split_part(s.consrc, ',', 2))::integer
-	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
+	FROM pg_class c, pg_namespace n, pg_attribute a
+		, (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE n.nspname = $1
 		AND c.relname = $2
 		AND a.attname = $3
@@ -8694,7 +8722,8 @@
 		pg_attribute a,
 		pg_type t,
 		pg_namespace n,
-		pg_constraint s
+		(SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+			FROM pg_constraint) AS s
 	WHERE t.typname = 'raster'::name
 		AND a.attisdropped = false
 		AND a.atttypid = t.oid

Modified: branches/2.5/topology/topology.sql.in
===================================================================
--- branches/2.5/topology/topology.sql.in	2018-11-22 16:18:14 UTC (rev 17059)
+++ branches/2.5/topology/topology.sql.in	2018-11-22 21:10:50 UTC (rev 17060)
@@ -829,7 +829,8 @@
     --c.consrc src,
     regexp_matches(c.consrc,
       '\.topology_id = (\d+).*\.layer_id = (\d+).*\.type = (\d+)') inf
-  FROM pg_constraint c, pg_class r, pg_namespace n
+  FROM (SELECT conname, connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+		    FROM pg_constraint) AS c, pg_class r, pg_namespace n
   WHERE c.conname LIKE 'check_topogeom_%'
     AND r.oid = c.conrelid
     AND n.oid = r.relnamespace



More information about the postgis-tickets mailing list