-- the terms of the GNU General Public Licence. See the COPYING file.
--
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+--
+-- WARNING: Any change in this file must be evaluated for
+-- deciding the SCRIPTS_VERSION upgrade in Version.config
+-- Changes which can be imported using the
+-- utils/postgis_proc_upgrade.pl script are COMPATIBLE
+-- and only require a MICRO version increment.
+-- All other changes are NOT COMPATILBLE and require a
+-- MINOR or MAJOR increment (difference between the two
+-- is not defined yet).
+--
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
#define CREATEFUNCTION CREATE OR REPLACE FUNCTION
# define _VOLATILE_STRICT VOLATILE STRICT
# define _VOLATILE VOLATILE
# define _STRICT STRICT
-#else // USE_VERSION <= 72
+#else
# define _IMMUTABLE_STRICT with(iscachable,isstrict)
# define _IMMUTABLE with(iscachable)
# define _STABLE_STRICT with(isstrict)
# define _VOLATILE_STRICT with(isstrict)
# define _VOLATILE
# define _STRICT with(isstrict)
-#endif // USE_VERSION <= 72
+#endif
BEGIN;
delimiter = ':',
#if USE_VERSION >= 80
analyze = geometry_analyze,
-#endif // USE_VERSION >= 80
+#endif
storage = main
);
OPERATOR 5 > ,
FUNCTION 1 geometry_cmp (geometry, geometry);
-#endif // USE_VERSION >= 74
+#endif
+// USE_VERSION >= 74
-------------------------------------------------------------------
and opcname = 'gist_geometry_ops'
and proname = 'lwgeom_gist_same';
-#else // USE_VERSION >= 73
+#else
+// USE_VERSION >= 73
--
-- Create opclass index bindings for PG>=73
-- TODO: add btree binding...
-#endif // USE_VERSION >= 73
+#endif
+// USE_VERSION >= 73
-- other lwgeom functions
AS '@MODULE_FILENAME@', 'LWGEOM_dump'
LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (isstrict,iscachable);
-#endif // USE_VERSION > 72
+#endif
+// USE_VERSION > 72
------------------------------------------------------------------------
END
'
LANGUAGE 'plpgsql' _STABLE_STRICT; -- WITH (isstrict);
-#endif // USE_VERSION >= 73
+#endif
+// USE_VERSION >= 73
-----------------------------------------------------------------------
-- EXPLODE_HISTOGRAM2D( <histogram2d>, <tablename> )
);
GET DIAGNOSTICS foundschema = ROW_COUNT;
-#endif // USE_VERSION >= 73
+#endif
+// USE_VERSION >= 73
#if USE_VERSION >= 80
-- no linkage to system table needed
#if USE_VERSION >= 73
pg_namespace n,
pg_constraint sridcheck, pg_constraint typecheck
-#else // USE_VERSION < 73
+#else
pg_relcheck sridcheck, pg_relcheck typecheck
-#endif // USE_VERSION < 73
+#endif
WHERE t.typname = ''geometry''
AND a.atttypid = t.oid
AND typecheck.conrelid = c.oid
AND typecheck.consrc LIKE
''((geometrytype(''||a.attname||'') = ''''%''''::text) OR (% IS NULL))''
-#else // USE_VERSION < 73
+#else
+// USE_VERSION < 73
AND sridcheck.rcrelid = c.oid
AND sridcheck.rcsrc LIKE ''(srid(''||a.attname||'') = %)''
AND typecheck.rcrelid = c.oid
AND typecheck.rcsrc LIKE
''((geometrytype(''||a.attname||'') = ''''%''''::text) OR (% IS NULL))''
-#endif // USE_VERSION < 73
+#endif
+// USE_VERSION < 73
;
INSERT INTO geometry_columns SELECT
#if USE_VERSION >= 73
pg_namespace n,
pg_constraint sridcheck, pg_constraint typecheck
-#else // USE_VERSION < 73
+#else
pg_relcheck sridcheck, pg_relcheck typecheck
-#endif // USE_VERSION < 73
+#endif
WHERE t.typname = ''geometry''
AND a.atttypid = t.oid
AND a.attrelid = c.oid
AND typecheck.conrelid = c.oid
AND typecheck.consrc LIKE
''((geometrytype(''||a.attname||'') = ''''%''''::text) OR (% IS NULL))''
-#else // USE_VERSION < 73
+#else
+// USE_VERSION < 73
AND sridcheck.rcrelid = c.oid
AND sridcheck.rcsrc LIKE ''(srid(''||a.attname||'') = %)''
AND typecheck.rcrelid = c.oid
AND typecheck.rcsrc LIKE
''((geometrytype(''||a.attname||'') = ''''%''''::text) OR (% IS NULL))''
-#endif // USE_VERSION < 73
+#endif
+// USE_VERSION < 73
AND NOT EXISTS (
SELECT oid FROM geometry_columns gc
END IF;
#else
real_schema = schema_name;
-#endif // USE_VERSION >= 73
+#endif
+// USE_VERSION >= 73
-- Find out if the column is in the geometry_columns table
okay = ''f'';
ELSE
real_schema = schema_name;
END IF;
-#endif // USE_VERSION >= 73
+#endif
+// USE_VERSION >= 73
-- Remove refs from geometry_columns table
EXECUTE ''DELETE FROM geometry_columns WHERE '' ||
ELSE
SELECT INTO real_schema current_schema()::text;
END IF;
-#endif // USE_VERSION >= 73
+#endif
+// USE_VERSION >= 73
-- Find out if the column is in the geometry_columns table
okay = ''f'';
#if USE_VERSION >= 80
CREATEFUNCTION update_geometry_stats() RETURNS text
AS ' SELECT ''update_geometry_stats() has been obsoleted. Statistics are automatically built running the ANALYZE command''::text' LANGUAGE 'sql';
-#else // USE_VERSION < 80
+#else
+// USE_VERSION < 80
CREATEFUNCTION update_geometry_stats()
RETURNS text
AS
WHERE n.nspname = f_table_schema::name
AND c.relname = f_table_name::name
AND c.relnamespace = n.oid
-#else // USE_VERSION < 73
+#else
+// USE_VERSION < 73
stats = (build_histogram2d(create_histogram2d(
find_extent(f_table_name, f_geometry_column),
40), f_table_name, f_geometry_column))
END;
'
LANGUAGE 'plpgsql' _VOLATILE_STRICT;
-#endif // USE_VERSION < 80
+#endif
+// USE_VERSION < 80
-----------------------------------------------------------------------
-- UPDATE_GEOMETRY_STATS( <table>, <column> )
AND a.attname = f_geometry_column::name
AND c.relnamespace = n.oid
AND a.attrelid = c.oid
-#else // USE_VERSION < 73
+#else
+// USE_VERSION < 73
stats = (build_histogram2d(create_histogram2d(
find_extent(f_table_name, f_geometry_column),
40), f_table_name, f_geometry_column))
'
LANGUAGE 'plpgsql' _VOLATILE_STRICT;
-#endif // USE_VERSION < 80
+#endif
+// USE_VERSION < 80
-----------------------------------------------------------------------
-- FIND_SRID( <schema>, <table>, <geom col> )