Commit 57814301 authored by Regina Obe's avatar Regina Obe

Put back deprecated functions removed in r17029, but patch them to use newer...

Put back deprecated functions removed in r17029, but patch them to use newer pg_get_constraintdef function.
Also mark them as undeprecated cause they are used in other management functions, and it's too messy to change those to use teh raw sql.
We maybe stuck with these forever :(
Closes #4243 for PostGIS 3.0

Also fix error in raster patching
References #4231 for PostGIS 3.0

git-svn-id: http://svn.osgeo.org/postgis/trunk@17030 b70326c6-7e19-0410-871a-916f4a2858ee
parent debd4dd6
Pipeline #37044241 failed with stage
in 5 minutes and 32 seconds
......@@ -10,12 +10,6 @@ PostGIS 3.0.0
dimentions that aren't present in both operands.
Please REINDEX your ND indexes after upgrade.
- #4231, remove deprecated functions postgis_constraint_srid,
postgis_constraint_dims, postgis_constraint_type
These were deprecated in PostGIS 2.2.0
and used pg_constraint.consrc which was removed in PostgreSQL 12
(Regina Obe)
* New Features *
- #2902, postgis_geos_noop (Sandro Santilli)
- #4128, ST_AsMVT support for Feature ID (Stepan Kuzmin)
......
......@@ -122,7 +122,8 @@ PG_OBJS= \
mvt.o \
lwgeom_out_mvt.o \
geobuf.o \
lwgeom_out_geobuf.o
lwgeom_out_geobuf.o \
postgis_legacy.o
# Objects to build using PGXS
OBJS=$(PG_OBJS)
......
......@@ -5668,6 +5668,65 @@ $$
$$
LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL COST 200;
-- Availability: 2.0.0
-- TODO: Can't deprecate this because UpdateGeometrySRID still uses them
CREATE OR REPLACE FUNCTION postgis_constraint_srid(geomschema text, geomtable text, geomcolumn text) RETURNS integer AS
$$
SELECT replace(replace(split_part(s.consrc, ' = ', 2), ')', ''), '(', '')::integer
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
AND a.attrelid = c.oid
AND s.connamespace = n.oid
AND s.conrelid = c.oid
AND a.attnum = ANY (s.conkey)
AND s.consrc LIKE '%srid(% = %';
$$
LANGUAGE 'sql' STABLE STRICT _PARALLEL;
-- Availability: 2.0.0
-- TODO: Can't deprecate this because UpdateGeometrySRID still uses them
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
, (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
AND a.attrelid = c.oid
AND s.connamespace = n.oid
AND s.conrelid = c.oid
AND a.attnum = ANY (s.conkey)
AND s.consrc LIKE '%ndims(% = %';
$$
LANGUAGE 'sql' STABLE STRICT _PARALLEL;
-- support function to pull out geometry type from constraint check
-- will return pretty name instead of ugly name
-- Availability: 2.0.0
-- TODO: Can't deprecate this because UpdateGeometrySRID still uses them
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
, (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
AND a.attrelid = c.oid
AND s.connamespace = n.oid
AND s.conrelid = c.oid
AND a.attnum = ANY (s.conkey)
AND s.consrc LIKE '%geometrytype(% = %';
$$
LANGUAGE 'sql' STABLE STRICT _PARALLEL;
-- Availability: 2.0.0
-- 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
......@@ -5690,7 +5749,7 @@ CREATE OR REPLACE VIEW geometry_columns AS
s.conrelid,
s.conkey, replace(split_part(s.consrc, ''''::text, 2), ')'::text, ''::text) As type
FROM (SELECT connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
FROM pg_constraint) AS s
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))
......
......@@ -175,10 +175,6 @@ DROP FUNCTION IF EXISTS _ST_DumpPoints( geometry, integer[]); -- removed 2.4.0,
DROP FUNCTION IF EXISTS _ST_DistanceRectTree(g1 geometry, g2 geometry);
DROP FUNCTION IF EXISTS _ST_DistanceRectTreeCached(g1 geometry, g2 geometry);
DROP FUNCTION IF EXISTS postgis_constraint_srid(text,text,text);
DROP FUNCTION IF EXISTS postgis_constraint_dims(text,text,text);
DROP FUNCTION IF EXISTS postgis_constraint_type(text,text,text);
-- pgis_abs type was increased from 8 bytes in 2.1 to 16 bytes in 2.2
-- See #3460
......
......@@ -7572,7 +7572,7 @@ CREATE OR REPLACE FUNCTION _raster_constraint_info_spatially_unique(rastschema n
SELECT
TRUE
FROM pg_class c, pg_namespace n, pg_attribute a
, (SELECT connamespace, conrelid, conkey, contype, pg_get_constraintdef(oid) As consrc
, (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
......@@ -7623,7 +7623,7 @@ CREATE OR REPLACE FUNCTION _drop_raster_constraint_spatially_unique(rastschema n
SELECT
s.conname INTO cn
FROM pg_class c, pg_namespace n, pg_attribute a
, (SELECT connamespace, conrelid, conkey, contype, pg_get_constraintdef(oid) As consrc
, (SELECT connamespace, 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment