Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PostGIS: GCC preprocessor vs. Apple Clang v421
diff --git a/gcc/postgis_extension/postgis--2.0.0--2.0.2.sql b/clang/postgis_extension/postgis--2.0.0--2.0.2.sql
index 2b555e1..f1e028a 100644
--- a/gcc/postgis_extension/postgis--2.0.0--2.0.2.sql
+++ b/clang/postgis_extension/postgis--2.0.0--2.0.2.sql
@@ -183,671 +183,671 @@ DROP FUNCTION IF EXISTS ST_MakeEnvelope(float8, float8, float8, float8);
DROP FUNCTION IF EXISTS ST_AsX3D(geometry, integer, integer);
DROP FUNCTION IF EXISTS UpdateGeometrySRID(varchar,varchar,varchar,varchar,integer);
CREATE OR REPLACE FUNCTION spheroid_in(cstring)
- RETURNS spheroid
- AS '$libdir/postgis-2.0','ellipsoid_in'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS spheroid
+ AS '$libdir/postgis-2.0','ellipsoid_in'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION spheroid_out(spheroid)
- RETURNS cstring
- AS '$libdir/postgis-2.0','ellipsoid_out'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS cstring
+ AS '$libdir/postgis-2.0','ellipsoid_out'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_in(cstring)
- RETURNS geometry
- AS '$libdir/postgis-2.0','LWGEOM_in'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','LWGEOM_in'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_out(geometry)
- RETURNS cstring
- AS '$libdir/postgis-2.0','LWGEOM_out'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS cstring
+ AS '$libdir/postgis-2.0','LWGEOM_out'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_typmod_in(cstring[])
- RETURNS integer
- AS '$libdir/postgis-2.0','geometry_typmod_in'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS integer
+ AS '$libdir/postgis-2.0','geometry_typmod_in'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_typmod_out(integer)
- RETURNS cstring
- AS '$libdir/postgis-2.0','postgis_typmod_out'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS cstring
+ AS '$libdir/postgis-2.0','postgis_typmod_out'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_analyze(internal)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'geometry_analyze_2d'
- LANGUAGE 'c' VOLATILE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'geometry_analyze_2d'
+ LANGUAGE 'c' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION geometry_recv(internal)
- RETURNS geometry
- AS '$libdir/postgis-2.0','LWGEOM_recv'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','LWGEOM_recv'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_send(geometry)
- RETURNS bytea
- AS '$libdir/postgis-2.0','LWGEOM_send'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bytea
+ AS '$libdir/postgis-2.0','LWGEOM_send'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry(geometry, integer, boolean)
- RETURNS geometry
- AS '$libdir/postgis-2.0','geometry_enforce_typmod'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','geometry_enforce_typmod'
+ LANGUAGE 'c' IMMUTABLE STRICT;
DROP CAST IF EXISTS (geometry AS geometry);
CREATE CAST (geometry AS geometry) WITH FUNCTION geometry(geometry, integer, boolean) AS IMPLICIT;
CREATE OR REPLACE FUNCTION ST_X(geometry)
- RETURNS float8
- AS '$libdir/postgis-2.0','LWGEOM_x_point'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS float8
+ AS '$libdir/postgis-2.0','LWGEOM_x_point'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Y(geometry)
- RETURNS float8
- AS '$libdir/postgis-2.0','LWGEOM_y_point'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS float8
+ AS '$libdir/postgis-2.0','LWGEOM_y_point'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Z(geometry)
- RETURNS float8
- AS '$libdir/postgis-2.0','LWGEOM_z_point'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS float8
+ AS '$libdir/postgis-2.0','LWGEOM_z_point'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_M(geometry)
- RETURNS float8
- AS '$libdir/postgis-2.0','LWGEOM_m_point'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS float8
+ AS '$libdir/postgis-2.0','LWGEOM_m_point'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box3d_in(cstring)
- RETURNS box3d
- AS '$libdir/postgis-2.0', 'BOX3D_in'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box3d
+ AS '$libdir/postgis-2.0', 'BOX3D_in'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box3d_out(box3d)
- RETURNS cstring
- AS '$libdir/postgis-2.0', 'BOX3D_out'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS cstring
+ AS '$libdir/postgis-2.0', 'BOX3D_out'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box2d_in(cstring)
- RETURNS box2d
- AS '$libdir/postgis-2.0','BOX2D_in'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box2d
+ AS '$libdir/postgis-2.0','BOX2D_in'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box2d_out(box2d)
- RETURNS cstring
- AS '$libdir/postgis-2.0','BOX2D_out'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS cstring
+ AS '$libdir/postgis-2.0','BOX2D_out'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box2df_in(cstring)
- RETURNS box2df
- AS '$libdir/postgis-2.0','box2df_in'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box2df
+ AS '$libdir/postgis-2.0','box2df_in'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box2df_out(box2df)
- RETURNS cstring
- AS '$libdir/postgis-2.0','box2df_out'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS cstring
+ AS '$libdir/postgis-2.0','box2df_out'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gidx_in(cstring)
- RETURNS gidx
- AS '$libdir/postgis-2.0','gidx_in'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS gidx
+ AS '$libdir/postgis-2.0','gidx_in'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION gidx_out(gidx)
- RETURNS cstring
- AS '$libdir/postgis-2.0','gidx_out'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS cstring
+ AS '$libdir/postgis-2.0','gidx_out'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_lt(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'lwgeom_lt'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'lwgeom_lt'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_le(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'lwgeom_le'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'lwgeom_le'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_gt(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'lwgeom_gt'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'lwgeom_gt'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_ge(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'lwgeom_ge'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'lwgeom_ge'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_eq(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'lwgeom_eq'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'lwgeom_eq'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_cmp(geom1 geometry, geom2 geometry)
- RETURNS integer
- AS '$libdir/postgis-2.0', 'lwgeom_cmp'
- LANGUAGE 'c' IMMUTABLE STRICT;
-CREATE OR REPLACE FUNCTION geometry_gist_distance_2d(internal,geometry,int4)
- RETURNS float8
- AS '$libdir/postgis-2.0' ,'gserialized_gist_distance_2d'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_consistent_2d(internal,geometry,int4)
- RETURNS bool
- AS '$libdir/postgis-2.0' ,'gserialized_gist_consistent_2d'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_compress_2d(internal)
- RETURNS internal
- AS '$libdir/postgis-2.0','gserialized_gist_compress_2d'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_penalty_2d(internal,internal,internal)
- RETURNS internal
- AS '$libdir/postgis-2.0' ,'gserialized_gist_penalty_2d'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_picksplit_2d(internal, internal)
- RETURNS internal
- AS '$libdir/postgis-2.0' ,'gserialized_gist_picksplit_2d'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_union_2d(bytea, internal)
- RETURNS internal
- AS '$libdir/postgis-2.0' ,'gserialized_gist_union_2d'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_same_2d(geom1 geometry, geom2 geometry, internal)
- RETURNS internal
- AS '$libdir/postgis-2.0' ,'gserialized_gist_same_2d'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_decompress_2d(internal)
- RETURNS internal
- AS '$libdir/postgis-2.0' ,'gserialized_gist_decompress_2d'
- LANGUAGE 'c';
+ RETURNS integer
+ AS '$libdir/postgis-2.0', 'lwgeom_cmp'
+ LANGUAGE 'c' IMMUTABLE STRICT;
+CREATE OR REPLACE FUNCTION geometry_gist_distance_2d(internal,geometry,int4)
+ RETURNS float8
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_distance_2d'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_consistent_2d(internal,geometry,int4)
+ RETURNS bool
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_consistent_2d'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_compress_2d(internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0','gserialized_gist_compress_2d'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_penalty_2d(internal,internal,internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_penalty_2d'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_picksplit_2d(internal, internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_picksplit_2d'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_union_2d(bytea, internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_union_2d'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_same_2d(geom1 geometry, geom2 geometry, internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_same_2d'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_decompress_2d(internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_decompress_2d'
+ LANGUAGE 'c';
CREATE OR REPLACE FUNCTION geometry_gist_sel_2d (internal, oid, internal, int4)
- RETURNS float8
- AS '$libdir/postgis-2.0', 'geometry_gist_sel_2d'
- LANGUAGE 'c';
+ RETURNS float8
+ AS '$libdir/postgis-2.0', 'geometry_gist_sel_2d'
+ LANGUAGE 'c';
CREATE OR REPLACE FUNCTION geometry_gist_joinsel_2d(internal, oid, internal, smallint)
- RETURNS float8
- AS '$libdir/postgis-2.0', 'geometry_gist_joinsel_2d'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_overlaps(geom1 geometry, geom2 geometry)
- RETURNS boolean
- AS '$libdir/postgis-2.0' ,'gserialized_overlaps_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
-CREATE OR REPLACE FUNCTION geometry_same(geom1 geometry, geom2 geometry)
- RETURNS boolean
- AS '$libdir/postgis-2.0' ,'gserialized_same_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
-CREATE OR REPLACE FUNCTION geometry_distance_centroid(geom1 geometry, geom2 geometry)
- RETURNS float8
- AS '$libdir/postgis-2.0' ,'gserialized_distance_centroid_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
-CREATE OR REPLACE FUNCTION geometry_distance_box(geom1 geometry, geom2 geometry)
- RETURNS float8
- AS '$libdir/postgis-2.0' ,'gserialized_distance_box_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS float8
+ AS '$libdir/postgis-2.0', 'geometry_gist_joinsel_2d'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_overlaps(geom1 geometry, geom2 geometry)
+ RETURNS boolean
+ AS '$libdir/postgis-2.0' ,'gserialized_overlaps_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
+CREATE OR REPLACE FUNCTION geometry_same(geom1 geometry, geom2 geometry)
+ RETURNS boolean
+ AS '$libdir/postgis-2.0' ,'gserialized_same_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
+CREATE OR REPLACE FUNCTION geometry_distance_centroid(geom1 geometry, geom2 geometry)
+ RETURNS float8
+ AS '$libdir/postgis-2.0' ,'gserialized_distance_centroid_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
+CREATE OR REPLACE FUNCTION geometry_distance_box(geom1 geometry, geom2 geometry)
+ RETURNS float8
+ AS '$libdir/postgis-2.0' ,'gserialized_distance_box_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_contains(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'gserialized_contains_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'gserialized_contains_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_within(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'gserialized_within_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'gserialized_within_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_left(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'gserialized_left_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'gserialized_left_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_overleft(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'gserialized_overleft_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'gserialized_overleft_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_below(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'gserialized_below_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'gserialized_below_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_overbelow(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'gserialized_overbelow_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'gserialized_overbelow_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_overright(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'gserialized_overright_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'gserialized_overright_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_right(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'gserialized_right_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'gserialized_right_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_overabove(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'gserialized_overabove_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'gserialized_overabove_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry_above(geom1 geometry, geom2 geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'gserialized_above_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
-CREATE OR REPLACE FUNCTION geometry_gist_consistent_nd(internal,geometry,int4)
- RETURNS bool
- AS '$libdir/postgis-2.0' ,'gserialized_gist_consistent'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_compress_nd(internal)
- RETURNS internal
- AS '$libdir/postgis-2.0','gserialized_gist_compress'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_penalty_nd(internal,internal,internal)
- RETURNS internal
- AS '$libdir/postgis-2.0' ,'gserialized_gist_penalty'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_picksplit_nd(internal, internal)
- RETURNS internal
- AS '$libdir/postgis-2.0' ,'gserialized_gist_picksplit'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_union_nd(bytea, internal)
- RETURNS internal
- AS '$libdir/postgis-2.0' ,'gserialized_gist_union'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_same_nd(geometry, geometry, internal)
- RETURNS internal
- AS '$libdir/postgis-2.0' ,'gserialized_gist_same'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_gist_decompress_nd(internal)
- RETURNS internal
- AS '$libdir/postgis-2.0' ,'gserialized_gist_decompress'
- LANGUAGE 'c';
-CREATE OR REPLACE FUNCTION geometry_overlaps_nd(geometry, geometry)
- RETURNS boolean
- AS '$libdir/postgis-2.0' ,'gserialized_overlaps'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'gserialized_above_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
+CREATE OR REPLACE FUNCTION geometry_gist_consistent_nd(internal,geometry,int4)
+ RETURNS bool
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_consistent'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_compress_nd(internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0','gserialized_gist_compress'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_penalty_nd(internal,internal,internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_penalty'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_picksplit_nd(internal, internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_picksplit'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_union_nd(bytea, internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_union'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_same_nd(geometry, geometry, internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_same'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_gist_decompress_nd(internal)
+ RETURNS internal
+ AS '$libdir/postgis-2.0' ,'gserialized_gist_decompress'
+ LANGUAGE 'c';
+CREATE OR REPLACE FUNCTION geometry_overlaps_nd(geometry, geometry)
+ RETURNS boolean
+ AS '$libdir/postgis-2.0' ,'gserialized_overlaps'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Affine(geometry,float8,float8,float8,float8,float8,float8,float8,float8,float8,float8,float8,float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_affine'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_affine'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Affine(geometry,float8,float8,float8,float8,float8,float8)
- RETURNS geometry
- AS 'SELECT ST_Affine($1, $2, $3, 0, $4, $5, 0, 0, 0, 1, $6, $7, 0)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Affine($1, $2, $3, 0, $4, $5, 0, 0, 0, 1, $6, $7, 0)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Rotate(geometry,float8)
- RETURNS geometry
- AS 'SELECT ST_Affine($1, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0, 1, 0, 0, 0)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Affine($1, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0, 1, 0, 0, 0)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Rotate(geometry,float8,float8,float8)
- RETURNS geometry
- AS 'SELECT ST_Affine($1, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0, 1, $3 - cos($2) * $3 + sin($2) * $4, $4 - sin($2) * $3 - cos($2) * $4, 0)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Affine($1, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0, 1, $3 - cos($2) * $3 + sin($2) * $4, $4 - sin($2) * $3 - cos($2) * $4, 0)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Rotate(geometry,float8,geometry)
- RETURNS geometry
- AS 'SELECT ST_Affine($1, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0, 1, ST_X($3) - cos($2) * ST_X($3) + sin($2) * ST_Y($3), ST_Y($3) - sin($2) * ST_X($3) - cos($2) * ST_Y($3), 0)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Affine($1, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0, 1, ST_X($3) - cos($2) * ST_X($3) + sin($2) * ST_Y($3), ST_Y($3) - sin($2) * ST_X($3) - cos($2) * ST_Y($3), 0)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_RotateZ(geometry,float8)
- RETURNS geometry
- AS 'SELECT ST_Rotate($1, $2)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Rotate($1, $2)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_RotateX(geometry,float8)
- RETURNS geometry
- AS 'SELECT ST_Affine($1, 1, 0, 0, 0, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Affine($1, 1, 0, 0, 0, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_RotateY(geometry,float8)
- RETURNS geometry
- AS 'SELECT ST_Affine($1, cos($2), 0, sin($2), 0, 1, 0, -sin($2), 0, cos($2), 0, 0, 0)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Affine($1, cos($2), 0, sin($2), 0, 1, 0, -sin($2), 0, cos($2), 0, 0, 0)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Translate(geometry,float8,float8,float8)
- RETURNS geometry
- AS 'SELECT ST_Affine($1, 1, 0, 0, 0, 1, 0, 0, 0, 1, $2, $3, $4)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Affine($1, 1, 0, 0, 0, 1, 0, 0, 0, 1, $2, $3, $4)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Translate(geometry,float8,float8)
- RETURNS geometry
- AS 'SELECT ST_Translate($1, $2, $3, 0)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Translate($1, $2, $3, 0)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Scale(geometry,float8,float8,float8)
- RETURNS geometry
- AS 'SELECT ST_Affine($1, $2, 0, 0, 0, $3, 0, 0, 0, $4, 0, 0, 0)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Affine($1, $2, 0, 0, 0, $3, 0, 0, 0, $4, 0, 0, 0)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Scale(geometry,float8,float8)
- RETURNS geometry
- AS 'SELECT ST_Scale($1, $2, $3, 1)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Scale($1, $2, $3, 1)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Transscale(geometry,float8,float8,float8,float8)
- RETURNS geometry
- AS 'SELECT ST_Affine($1, $4, 0, 0, 0, $5, 0,
- 0, 0, 1, $2 * $4, $3 * $5, 0)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_Affine($1, $4, 0, 0, 0, $5, 0,
+ 0, 0, 1, $2 * $4, $3 * $5, 0)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Shift_Longitude(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_longitude_shift'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_longitude_shift'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_XMin(box3d)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','BOX3D_xmin'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','BOX3D_xmin'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_YMin(box3d)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','BOX3D_ymin'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','BOX3D_ymin'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_ZMin(box3d)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','BOX3D_zmin'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','BOX3D_zmin'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_XMax(box3d)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','BOX3D_xmax'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','BOX3D_xmax'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_YMax(box3d)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','BOX3D_ymax'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','BOX3D_ymax'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_ZMax(box3d)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','BOX3D_zmax'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','BOX3D_zmax'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_expand(box2d,float8)
- RETURNS box2d
- AS '$libdir/postgis-2.0', 'BOX2D_expand'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box2d
+ AS '$libdir/postgis-2.0', 'BOX2D_expand'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION postgis_getbbox(geometry)
- RETURNS box2d
- AS '$libdir/postgis-2.0','LWGEOM_to_BOX2D'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box2d
+ AS '$libdir/postgis-2.0','LWGEOM_to_BOX2D'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_MakeBox2d(geom1 geometry, geom2 geometry)
- RETURNS box2d
- AS '$libdir/postgis-2.0', 'BOX2D_construct'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box2d
+ AS '$libdir/postgis-2.0', 'BOX2D_construct'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Combine_BBox(box2d,geometry)
- RETURNS box2d
- AS '$libdir/postgis-2.0', 'BOX2D_combine'
- LANGUAGE 'c' IMMUTABLE;
+ RETURNS box2d
+ AS '$libdir/postgis-2.0', 'BOX2D_combine'
+ LANGUAGE 'c' IMMUTABLE;
CREATE OR REPLACE FUNCTION ST_estimated_extent(text,text,text) RETURNS box2d AS
- '$libdir/postgis-2.0', 'geometry_estimated_extent'
- LANGUAGE 'c' IMMUTABLE STRICT SECURITY DEFINER;
+ '$libdir/postgis-2.0', 'geometry_estimated_extent'
+ LANGUAGE 'c' IMMUTABLE STRICT SECURITY DEFINER;
CREATE OR REPLACE FUNCTION ST_estimated_extent(text,text) RETURNS box2d AS
- '$libdir/postgis-2.0', 'geometry_estimated_extent'
- LANGUAGE 'c' IMMUTABLE STRICT SECURITY DEFINER;
+ '$libdir/postgis-2.0', 'geometry_estimated_extent'
+ LANGUAGE 'c' IMMUTABLE STRICT SECURITY DEFINER;
CREATE OR REPLACE FUNCTION ST_find_extent(text,text,text) RETURNS box2d AS
$$
DECLARE
- schemaname alias for $1;
- tablename alias for $2;
- columnname alias for $3;
- myrec RECORD;
+ schemaname alias for $1;
+ tablename alias for $2;
+ columnname alias for $3;
+ myrec RECORD;
BEGIN
- FOR myrec IN EXECUTE 'SELECT ST_Extent("' || columnname || '") As extent FROM "' || schemaname || '"."' || tablename || '"' LOOP
- return myrec.extent;
- END LOOP;
+ FOR myrec IN EXECUTE 'SELECT ST_Extent("' || columnname || '") As extent FROM "' || schemaname || '"."' || tablename || '"' LOOP
+ return myrec.extent;
+ END LOOP;
END;
$$
LANGUAGE 'plpgsql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_find_extent(text,text) RETURNS box2d AS
$$
DECLARE
- tablename alias for $1;
- columnname alias for $2;
- myrec RECORD;
+ tablename alias for $1;
+ columnname alias for $2;
+ myrec RECORD;
BEGIN
- FOR myrec IN EXECUTE 'SELECT ST_Extent("' || columnname || '") As extent FROM "' || tablename || '"' LOOP
- return myrec.extent;
- END LOOP;
+ FOR myrec IN EXECUTE 'SELECT ST_Extent("' || columnname || '") As extent FROM "' || tablename || '"' LOOP
+ return myrec.extent;
+ END LOOP;
END;
$$
LANGUAGE 'plpgsql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION postgis_addbbox(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0','LWGEOM_addBBOX'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','LWGEOM_addBBOX'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION postgis_dropbbox(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0','LWGEOM_dropBBOX'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','LWGEOM_dropBBOX'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION postgis_hasbbox(geometry)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'LWGEOM_hasBBOX'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'LWGEOM_hasBBOX'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_mem_size(geometry)
- RETURNS int4
- AS '$libdir/postgis-2.0', 'LWGEOM_mem_size'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS int4
+ AS '$libdir/postgis-2.0', 'LWGEOM_mem_size'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_summary(geometry)
- RETURNS text
- AS '$libdir/postgis-2.0', 'LWGEOM_summary'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS text
+ AS '$libdir/postgis-2.0', 'LWGEOM_summary'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Npoints(geometry)
- RETURNS int4
- AS '$libdir/postgis-2.0', 'LWGEOM_npoints'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS int4
+ AS '$libdir/postgis-2.0', 'LWGEOM_npoints'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_nrings(geometry)
- RETURNS int4
- AS '$libdir/postgis-2.0', 'LWGEOM_nrings'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS int4
+ AS '$libdir/postgis-2.0', 'LWGEOM_nrings'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_3DLength(geometry)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0', 'LWGEOM_length_linestring'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0', 'LWGEOM_length_linestring'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Length2d(geometry)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0', 'LWGEOM_length2d_linestring'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0', 'LWGEOM_length2d_linestring'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Length(geometry)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0', 'LWGEOM_length2d_linestring'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0', 'LWGEOM_length2d_linestring'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_3DLength_spheroid(geometry, spheroid)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','LWGEOM_length_ellipsoid_linestring'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','LWGEOM_length_ellipsoid_linestring'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_length_spheroid(geometry, spheroid)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','LWGEOM_length_ellipsoid_linestring'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','LWGEOM_length_ellipsoid_linestring'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_length2d_spheroid(geometry, spheroid)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','LWGEOM_length2d_ellipsoid'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','LWGEOM_length2d_ellipsoid'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_3DPerimeter(geometry)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0', 'LWGEOM_perimeter_poly'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0', 'LWGEOM_perimeter_poly'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_perimeter2d(geometry)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0', 'LWGEOM_perimeter2d_poly'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0', 'LWGEOM_perimeter2d_poly'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Perimeter(geometry)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0', 'LWGEOM_perimeter2d_poly'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0', 'LWGEOM_perimeter2d_poly'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_area2d(geometry)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0', 'LWGEOM_area_polygon'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0', 'LWGEOM_area_polygon'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Area(geometry)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','LWGEOM_area_polygon'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','LWGEOM_area_polygon'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_distance_spheroid(geom1 geometry, geom2 geometry,spheroid)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0','LWGEOM_distance_ellipsoid'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0','LWGEOM_distance_ellipsoid'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_Distance(geom1 geometry, geom2 geometry)
- RETURNS float8
- AS '$libdir/postgis-2.0', 'LWGEOM_mindistance2d'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS float8
+ AS '$libdir/postgis-2.0', 'LWGEOM_mindistance2d'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_point_inside_circle(geometry,float8,float8,float8)
- RETURNS bool
- AS '$libdir/postgis-2.0', 'LWGEOM_inside_circle_point'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bool
+ AS '$libdir/postgis-2.0', 'LWGEOM_inside_circle_point'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_azimuth(geom1 geometry, geom2 geometry)
- RETURNS float8
- AS '$libdir/postgis-2.0', 'LWGEOM_azimuth'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS float8
+ AS '$libdir/postgis-2.0', 'LWGEOM_azimuth'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_force_2d(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_force_2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_force_2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_force_3dz(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_force_3dz'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_force_3dz'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_force_3d(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_force_3dz'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_force_3dz'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_force_3dm(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_force_3dm'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_force_3dm'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_force_4d(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_force_4d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_force_4d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_force_collection(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_force_collection'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_force_collection'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_CollectionExtract(geometry, integer)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'ST_CollectionExtract'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'ST_CollectionExtract'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_CollectionHomogenize(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'ST_CollectionHomogenize'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'ST_CollectionHomogenize'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Multi(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_force_multi'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_force_multi'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Expand(box3d,float8)
- RETURNS box3d
- AS '$libdir/postgis-2.0', 'BOX3D_expand'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box3d
+ AS '$libdir/postgis-2.0', 'BOX3D_expand'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Expand(geometry,float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_expand'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_expand'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Envelope(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_envelope'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_envelope'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Reverse(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_reverse'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_reverse'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_ForceRHR(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_force_clockwise_poly'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_force_clockwise_poly'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION postgis_noop(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_noop'
- LANGUAGE 'c' VOLATILE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_noop'
+ LANGUAGE 'c' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION ST_zmflag(geometry)
- RETURNS smallint
- AS '$libdir/postgis-2.0', 'LWGEOM_zmflag'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS smallint
+ AS '$libdir/postgis-2.0', 'LWGEOM_zmflag'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_NDims(geometry)
- RETURNS smallint
- AS '$libdir/postgis-2.0', 'LWGEOM_ndims'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS smallint
+ AS '$libdir/postgis-2.0', 'LWGEOM_ndims'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_AsEWKT(geometry)
- RETURNS TEXT
- AS '$libdir/postgis-2.0','LWGEOM_asEWKT'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS TEXT
+ AS '$libdir/postgis-2.0','LWGEOM_asEWKT'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_AsEWKB(geometry)
- RETURNS BYTEA
- AS '$libdir/postgis-2.0','WKBFromLWGEOM'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS BYTEA
+ AS '$libdir/postgis-2.0','WKBFromLWGEOM'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_AsHEXEWKB(geometry)
- RETURNS TEXT
- AS '$libdir/postgis-2.0','LWGEOM_asHEXEWKB'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS TEXT
+ AS '$libdir/postgis-2.0','LWGEOM_asHEXEWKB'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_AsHEXEWKB(geometry, text)
- RETURNS TEXT
- AS '$libdir/postgis-2.0','LWGEOM_asHEXEWKB'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS TEXT
+ AS '$libdir/postgis-2.0','LWGEOM_asHEXEWKB'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_AsEWKB(geometry,text)
- RETURNS bytea
- AS '$libdir/postgis-2.0','WKBFromLWGEOM'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bytea
+ AS '$libdir/postgis-2.0','WKBFromLWGEOM'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_AsLatLonText(geometry, text)
- RETURNS text
- AS '$libdir/postgis-2.0','LWGEOM_to_latlon'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS text
+ AS '$libdir/postgis-2.0','LWGEOM_to_latlon'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_AsLatLonText(geometry)
- RETURNS text
- AS $$ SELECT ST_AsLatLonText($1, '') $$
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS text
+ AS $$ SELECT ST_AsLatLonText($1, '') $$
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION GeomFromEWKB(bytea)
- RETURNS geometry
- AS '$libdir/postgis-2.0','LWGEOMFromWKB'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','LWGEOMFromWKB'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_GeomFromEWKB(bytea)
- RETURNS geometry
- AS '$libdir/postgis-2.0','LWGEOMFromWKB'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','LWGEOMFromWKB'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION GeomFromEWKT(text)
- RETURNS geometry
- AS '$libdir/postgis-2.0','parse_WKT_lwgeom'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','parse_WKT_lwgeom'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_GeomFromEWKT(text)
- RETURNS geometry
- AS '$libdir/postgis-2.0','parse_WKT_lwgeom'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','parse_WKT_lwgeom'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION postgis_cache_bbox()
- RETURNS trigger
- AS '$libdir/postgis-2.0', 'cache_bbox'
- LANGUAGE 'c';
+ RETURNS trigger
+ AS '$libdir/postgis-2.0', 'cache_bbox'
+ LANGUAGE 'c';
CREATE OR REPLACE FUNCTION ST_MakePoint(float8, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_makepoint'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_makepoint'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_MakePoint(float8, float8, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_makepoint'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_makepoint'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_MakePoint(float8, float8, float8, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_makepoint'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_makepoint'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_MakePointM(float8, float8, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_makepoint3dm'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_makepoint3dm'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_3DMakeBox(geom1 geometry, geom2 geometry)
- RETURNS box3d
- AS '$libdir/postgis-2.0', 'BOX3D_construct'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box3d
+ AS '$libdir/postgis-2.0', 'BOX3D_construct'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_MakeLine (geometry[])
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_makeline_garray'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_makeline_garray'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_LineFromMultiPoint(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_line_from_mpoint'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_line_from_mpoint'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_MakeLine(geom1 geometry, geom2 geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_makeline'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_makeline'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_AddPoint(geom1 geometry, geom2 geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_addpoint'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_addpoint'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_AddPoint(geom1 geometry, geom2 geometry, integer)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_addpoint'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_addpoint'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_RemovePoint(geometry, integer)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_removepoint'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_removepoint'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_SetPoint(geometry, integer, geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_setpoint_linestring'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_setpoint_linestring'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_MakeEnvelope(float8, float8, float8, float8, integer DEFAULT 0)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'ST_MakeEnvelope'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'ST_MakeEnvelope'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_MakePolygon(geometry, geometry[])
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_makepoly'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_makepoly'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_MakePolygon(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_makepoly'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_makepoly'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_BuildArea(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'ST_BuildArea'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'ST_BuildArea'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_Polygonize (geometry[])
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'polygonize_garray'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'polygonize_garray'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_LineMerge(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'linemerge'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'linemerge'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_Dump(geometry)
- RETURNS SETOF geometry_dump
- AS '$libdir/postgis-2.0', 'LWGEOM_dump'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS SETOF geometry_dump
+ AS '$libdir/postgis-2.0', 'LWGEOM_dump'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_DumpRings(geometry)
- RETURNS SETOF geometry_dump
- AS '$libdir/postgis-2.0', 'LWGEOM_dump_rings'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS SETOF geometry_dump
+ AS '$libdir/postgis-2.0', 'LWGEOM_dump_rings'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION _ST_DumpPoints(the_geom geometry, cur_path integer[]) RETURNS SETOF geometry_dump AS $$
DECLARE
tmp geometry_dump;
@@ -857,28 +857,28 @@ DECLARE
i integer;
j integer;
g geometry;
-
+
BEGIN
-
+
-- RAISE DEBUG '%,%', cur_path, ST_GeometryType(the_geom);
-- Special case collections : iterate and return the DumpPoints of the geometries
IF (ST_IsCollection(the_geom)) THEN
-
+
i = 1;
FOR tmp2 IN SELECT (ST_Dump(the_geom)).* LOOP
FOR tmp IN SELECT * FROM _ST_DumpPoints(tmp2.geom, cur_path || tmp2.path) LOOP
- RETURN NEXT tmp;
+ RETURN NEXT tmp;
END LOOP;
i = i + 1;
-
+
END LOOP;
RETURN;
END IF;
-
+
-- Special case (POLYGON) : return the points of the rings of a polygon
IF (ST_GeometryType(the_geom) = 'ST_Polygon') THEN
@@ -886,14 +886,14 @@ BEGIN
FOR tmp IN SELECT * FROM _ST_DumpPoints(ST_ExteriorRing(the_geom), cur_path || ARRAY[1]) LOOP
RETURN NEXT tmp;
END LOOP;
-
+
j := ST_NumInteriorRings(the_geom);
FOR i IN 1..j LOOP
FOR tmp IN SELECT * FROM _ST_DumpPoints(ST_InteriorRingN(the_geom, i), cur_path || ARRAY[i+1]) LOOP
RETURN NEXT tmp;
END LOOP;
END LOOP;
-
+
RETURN;
END IF;
@@ -903,11 +903,11 @@ BEGIN
FOR tmp IN SELECT * FROM _ST_DumpPoints(ST_ExteriorRing(the_geom), cur_path || ARRAY[1]) LOOP
RETURN NEXT tmp;
END LOOP;
-
+
RETURN;
END IF;
-
+
-- Special case (POINT) : return the point
IF (ST_GeometryType(the_geom) = 'ST_Point') THEN
@@ -934,154 +934,154 @@ BEGIN
tmp.geom := ST_PointN(the_geom, i);
RETURN NEXT tmp;
END LOOP;
-
+
END
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION ST_DumpPoints(geometry) RETURNS SETOF geometry_dump AS $$
SELECT * FROM _ST_DumpPoints($1, NULL);
-$$ LANGUAGE SQL STRICT;
+$$ LANGUAGE SQL STRICT;
CREATE OR REPLACE FUNCTION populate_geometry_columns(use_typmod boolean DEFAULT true)
- RETURNS text AS
+ RETURNS text AS
$$
DECLARE
- inserted integer;
- oldcount integer;
- probed integer;
- stale integer;
- gcs RECORD;
- gc RECORD;
- gsrid integer;
- gndims integer;
- gtype text;
- query text;
- gc_is_valid boolean;
+ inserted integer;
+ oldcount integer;
+ probed integer;
+ stale integer;
+ gcs RECORD;
+ gc RECORD;
+ gsrid integer;
+ gndims integer;
+ gtype text;
+ query text;
+ gc_is_valid boolean;
BEGIN
- SELECT count(*) INTO oldcount FROM geometry_columns;
- inserted := 0;
-
- -- Count the number of geometry columns in all tables and views
- SELECT count(DISTINCT c.oid) INTO probed
- FROM pg_class c,
- pg_attribute a,
- pg_type t,
- pg_namespace n
- WHERE (c.relkind = 'r' OR c.relkind = 'v')
- AND t.typname = 'geometry'
- AND a.attisdropped = false
- AND a.atttypid = t.oid
- AND a.attrelid = c.oid
- AND c.relnamespace = n.oid
- AND n.nspname NOT ILIKE 'pg_temp%' AND c.relname != 'raster_columns' ;
-
- -- Iterate through all non-dropped geometry columns
- RAISE DEBUG 'Processing Tables.....';
-
- FOR gcs IN
- SELECT DISTINCT ON (c.oid) c.oid, n.nspname, c.relname
- FROM pg_class c,
- pg_attribute a,
- pg_type t,
- pg_namespace n
- WHERE c.relkind = 'r'
- AND t.typname = 'geometry'
- AND a.attisdropped = false
- AND a.atttypid = t.oid
- AND a.attrelid = c.oid
- AND c.relnamespace = n.oid
- AND n.nspname NOT ILIKE 'pg_temp%' AND c.relname != 'raster_columns'
- LOOP
-
- inserted := inserted + populate_geometry_columns(gcs.oid, use_typmod);
- END LOOP;
-
- IF oldcount > inserted THEN
- stale = oldcount-inserted;
- ELSE
- stale = 0;
- END IF;
-
- RETURN 'probed:' ||probed|| ' inserted:'||inserted;
+ SELECT count(*) INTO oldcount FROM geometry_columns;
+ inserted := 0;
+
+ -- Count the number of geometry columns in all tables and views
+ SELECT count(DISTINCT c.oid) INTO probed
+ FROM pg_class c,
+ pg_attribute a,
+ pg_type t,
+ pg_namespace n
+ WHERE (c.relkind = 'r' OR c.relkind = 'v')
+ AND t.typname = 'geometry'
+ AND a.attisdropped = false
+ AND a.atttypid = t.oid
+ AND a.attrelid = c.oid
+ AND c.relnamespace = n.oid
+ AND n.nspname NOT ILIKE 'pg_temp%' AND c.relname != 'raster_columns' ;
+
+ -- Iterate through all non-dropped geometry columns
+ RAISE DEBUG 'Processing Tables.....';
+
+ FOR gcs IN
+ SELECT DISTINCT ON (c.oid) c.oid, n.nspname, c.relname
+ FROM pg_class c,
+ pg_attribute a,
+ pg_type t,
+ pg_namespace n
+ WHERE c.relkind = 'r'
+ AND t.typname = 'geometry'
+ AND a.attisdropped = false
+ AND a.atttypid = t.oid
+ AND a.attrelid = c.oid
+ AND c.relnamespace = n.oid
+ AND n.nspname NOT ILIKE 'pg_temp%' AND c.relname != 'raster_columns'
+ LOOP
+
+ inserted := inserted + populate_geometry_columns(gcs.oid, use_typmod);
+ END LOOP;
+
+ IF oldcount > inserted THEN
+ stale = oldcount-inserted;
+ ELSE
+ stale = 0;
+ END IF;
+
+ RETURN 'probed:' ||probed|| ' inserted:'||inserted;
END
$$
LANGUAGE 'plpgsql' VOLATILE;
CREATE OR REPLACE FUNCTION populate_geometry_columns(tbl_oid oid, use_typmod boolean DEFAULT true)
- RETURNS integer AS
+ RETURNS integer AS
$$
DECLARE
- gcs RECORD;
- gc RECORD;
- gc_old RECORD;
- gsrid integer;
- gndims integer;
- gtype text;
- query text;
- gc_is_valid boolean;
- inserted integer;
- constraint_successful boolean := false;
+ gcs RECORD;
+ gc RECORD;
+ gc_old RECORD;
+ gsrid integer;
+ gndims integer;
+ gtype text;
+ query text;
+ gc_is_valid boolean;
+ inserted integer;
+ constraint_successful boolean := false;
BEGIN
- inserted := 0;
-
- -- Iterate through all geometry columns in this table
- FOR gcs IN
- SELECT n.nspname, c.relname, a.attname
- FROM pg_class c,
- pg_attribute a,
- pg_type t,
- pg_namespace n
- WHERE c.relkind = 'r'
- AND t.typname = 'geometry'
- AND a.attisdropped = false
- AND a.atttypid = t.oid
- AND a.attrelid = c.oid
- AND c.relnamespace = n.oid
- AND n.nspname NOT ILIKE 'pg_temp%'
- AND c.oid = tbl_oid
- LOOP
+ inserted := 0;
+
+ -- Iterate through all geometry columns in this table
+ FOR gcs IN
+ SELECT n.nspname, c.relname, a.attname
+ FROM pg_class c,
+ pg_attribute a,
+ pg_type t,
+ pg_namespace n
+ WHERE c.relkind = 'r'
+ AND t.typname = 'geometry'
+ AND a.attisdropped = false
+ AND a.atttypid = t.oid
+ AND a.attrelid = c.oid
+ AND c.relnamespace = n.oid
+ AND n.nspname NOT ILIKE 'pg_temp%'
+ AND c.oid = tbl_oid
+ LOOP
RAISE DEBUG 'Processing table %.%.%', gcs.nspname, gcs.relname, gcs.attname;
-
+
gc_is_valid := true;
-- Find the srid, coord_dimension, and type of current geometry
-- in geometry_columns -- which is now a view
-
- SELECT type, srid, coord_dimension INTO gc_old
- FROM geometry_columns
- WHERE f_table_schema = gcs.nspname AND f_table_name = gcs.relname AND f_geometry_column = gcs.attname;
-
+
+ SELECT type, srid, coord_dimension INTO gc_old
+ FROM geometry_columns
+ WHERE f_table_schema = gcs.nspname AND f_table_name = gcs.relname AND f_geometry_column = gcs.attname;
+
IF upper(gc_old.type) = 'GEOMETRY' THEN
-- This is an unconstrained geometry we need to do something
-- We need to figure out what to set the type by inspecting the data
EXECUTE 'SELECT st_srid(' || quote_ident(gcs.attname) || ') As srid, GeometryType(' || quote_ident(gcs.attname) || ') As type, ST_NDims(' || quote_ident(gcs.attname) || ') As dims ' ||
- ' FROM ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) ||
+ ' FROM ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) ||
' WHERE ' || quote_ident(gcs.attname) || ' IS NOT NULL LIMIT 1;'
INTO gc;
IF gc IS NULL THEN -- there is no data so we can not determine geometry type
- RAISE WARNING 'No data in table %.%, so no information to determine geometry type and srid', gcs.nspname, gcs.relname;
- RETURN 0;
+ RAISE WARNING 'No data in table %.%, so no information to determine geometry type and srid', gcs.nspname, gcs.relname;
+ RETURN 0;
END IF;
gsrid := gc.srid; gtype := gc.type; gndims := gc.dims;
-
+
IF use_typmod THEN
BEGIN
- EXECUTE 'ALTER TABLE ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || ' ALTER COLUMN ' || quote_ident(gcs.attname) ||
- ' TYPE geometry(' || postgis_type_name(gtype, gndims, true) || ', ' || gsrid::text || ') ';
+ EXECUTE 'ALTER TABLE ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || ' ALTER COLUMN ' || quote_ident(gcs.attname) ||
+ ' TYPE geometry(' || postgis_type_name(gtype, gndims, true) || ', ' || gsrid::text || ') ';
inserted := inserted + 1;
EXCEPTION
WHEN invalid_parameter_value THEN
RAISE WARNING 'Could not convert ''%'' in ''%.%'' to use typmod with srid %, type: % ', quote_ident(gcs.attname), quote_ident(gcs.nspname), quote_ident(gcs.relname), gsrid, postgis_type_name(gtype, gndims, true);
gc_is_valid := false;
END;
-
+
ELSE
-- Try to apply srid check to column
- constraint_successful = false;
+ constraint_successful = false;
IF (gsrid > 0 AND postgis_constraint_srid(gcs.nspname, gcs.relname,gcs.attname) IS NULL ) THEN
BEGIN
- EXECUTE 'ALTER TABLE ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) ||
- ' ADD CONSTRAINT ' || quote_ident('enforce_srid_' || gcs.attname) ||
+ EXECUTE 'ALTER TABLE ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) ||
+ ' ADD CONSTRAINT ' || quote_ident('enforce_srid_' || gcs.attname) ||
' CHECK (st_srid(' || quote_ident(gcs.attname) || ') = ' || gsrid || ')';
constraint_successful := true;
EXCEPTION
@@ -1090,7 +1090,7 @@ BEGIN
gc_is_valid := false;
END;
END IF;
-
+
-- Try to apply ndims check to column
IF (gndims IS NOT NULL AND postgis_constraint_dims(gcs.nspname, gcs.relname,gcs.attname) IS NULL ) THEN
BEGIN
@@ -1104,7 +1104,7 @@ BEGIN
gc_is_valid := false;
END;
END IF;
-
+
-- Try to apply geometrytype check to column
IF (gtype IS NOT NULL AND postgis_constraint_type(gcs.nspname, gcs.relname,gcs.attname) IS NULL ) THEN
BEGIN
@@ -1120,133 +1120,133 @@ BEGIN
END IF;
--only count if we were successful in applying at least one constraint
IF constraint_successful THEN
- inserted := inserted + 1;
+ inserted := inserted + 1;
END IF;
- END IF;
- END IF;
+ END IF;
+ END IF;
- END LOOP;
+ END LOOP;
- RETURN inserted;
+ RETURN inserted;
END
$$
LANGUAGE 'plpgsql' VOLATILE;
CREATE OR REPLACE FUNCTION AddGeometryColumn(catalog_name varchar,schema_name varchar,table_name varchar,column_name varchar,new_srid_in integer,new_type varchar,new_dim integer, use_typmod boolean DEFAULT true)
- RETURNS text
- AS
+ RETURNS text
+ AS
$$
DECLARE
- rec RECORD;
- sr varchar;
- real_schema name;
- sql text;
- new_srid integer;
+ rec RECORD;
+ sr varchar;
+ real_schema name;
+ sql text;
+ new_srid integer;
BEGIN
- -- Verify geometry type
- IF (postgis_type_name(new_type,new_dim) IS NULL )
- THEN
- RAISE EXCEPTION 'Invalid type name "%(%)" - valid ones are:
- POINT, MULTIPOINT,
- LINESTRING, MULTILINESTRING,
- POLYGON, MULTIPOLYGON,
- CIRCULARSTRING, COMPOUNDCURVE, MULTICURVE,
- CURVEPOLYGON, MULTISURFACE,
- GEOMETRY, GEOMETRYCOLLECTION,
- POINTM, MULTIPOINTM,
- LINESTRINGM, MULTILINESTRINGM,
- POLYGONM, MULTIPOLYGONM,
- CIRCULARSTRINGM, COMPOUNDCURVEM, MULTICURVEM
- CURVEPOLYGONM, MULTISURFACEM, TRIANGLE, TRIANGLEM,
- POLYHEDRALSURFACE, POLYHEDRALSURFACEM, TIN, TINM
- or GEOMETRYCOLLECTIONM', new_type, new_dim;
- RETURN 'fail';
- END IF;
-
-
- -- Verify dimension
- IF ( (new_dim >4) OR (new_dim <2) ) THEN
- RAISE EXCEPTION 'invalid dimension';
- RETURN 'fail';
- END IF;
-
- IF ( (new_type LIKE '%M') AND (new_dim!=3) ) THEN
- RAISE EXCEPTION 'TypeM needs 3 dimensions';
- RETURN 'fail';
- END IF;
-
-
- -- Verify SRID
- IF ( new_srid_in > 0 ) THEN
- IF new_srid_in > 998999 THEN
- RAISE EXCEPTION 'AddGeometryColumn() - SRID must be <= %', 998999;
- END IF;
- new_srid := new_srid_in;
- SELECT SRID INTO sr FROM spatial_ref_sys WHERE SRID = new_srid;
- IF NOT FOUND THEN
- RAISE EXCEPTION 'AddGeometryColumn() - invalid SRID';
- RETURN 'fail';
- END IF;
- ELSE
- new_srid := ST_SRID('POINT EMPTY'::geometry);
- IF ( new_srid_in != new_srid ) THEN
- RAISE NOTICE 'SRID value % converted to the officially unknown SRID value %', new_srid_in, new_srid;
- END IF;
- END IF;
-
+ -- Verify geometry type
+ IF (postgis_type_name(new_type,new_dim) IS NULL )
+ THEN
+ RAISE EXCEPTION 'Invalid type name "%(%)" - valid ones are:
+ POINT, MULTIPOINT,
+ LINESTRING, MULTILINESTRING,
+ POLYGON, MULTIPOLYGON,
+ CIRCULARSTRING, COMPOUNDCURVE, MULTICURVE,
+ CURVEPOLYGON, MULTISURFACE,
+ GEOMETRY, GEOMETRYCOLLECTION,
+ POINTM, MULTIPOINTM,
+ LINESTRINGM, MULTILINESTRINGM,
+ POLYGONM, MULTIPOLYGONM,
+ CIRCULARSTRINGM, COMPOUNDCURVEM, MULTICURVEM
+ CURVEPOLYGONM, MULTISURFACEM, TRIANGLE, TRIANGLEM,
+ POLYHEDRALSURFACE, POLYHEDRALSURFACEM, TIN, TINM
+ or GEOMETRYCOLLECTIONM', new_type, new_dim;
+ RETURN 'fail';
+ END IF;
+
+
+ -- Verify dimension
+ IF ( (new_dim >4) OR (new_dim <2) ) THEN
+ RAISE EXCEPTION 'invalid dimension';
+ RETURN 'fail';
+ END IF;
+
+ IF ( (new_type LIKE '%M') AND (new_dim!=3) ) THEN
+ RAISE EXCEPTION 'TypeM needs 3 dimensions';
+ RETURN 'fail';
+ END IF;
+
+
+ -- Verify SRID
+ IF ( new_srid_in > 0 ) THEN
+ IF new_srid_in > 998999 THEN
+ RAISE EXCEPTION 'AddGeometryColumn() - SRID must be <= %', 998999;
+ END IF;
+ new_srid := new_srid_in;
+ SELECT SRID INTO sr FROM spatial_ref_sys WHERE SRID = new_srid;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'AddGeometryColumn() - invalid SRID';
+ RETURN 'fail';
+ END IF;
+ ELSE
+ new_srid := ST_SRID('POINT EMPTY'::geometry);
+ IF ( new_srid_in != new_srid ) THEN
+ RAISE NOTICE 'SRID value % converted to the officially unknown SRID value %', new_srid_in, new_srid;
+ END IF;
+ END IF;
- -- Verify schema
- IF ( schema_name IS NOT NULL AND schema_name != '' ) THEN
- sql := 'SELECT nspname FROM pg_namespace ' ||
- 'WHERE text(nspname) = ' || quote_literal(schema_name) ||
- 'LIMIT 1';
- RAISE DEBUG '%', sql;
- EXECUTE sql INTO real_schema;
- IF ( real_schema IS NULL ) THEN
- RAISE EXCEPTION 'Schema % is not a valid schemaname', quote_literal(schema_name);
- RETURN 'fail';
- END IF;
- END IF;
+ -- Verify schema
+ IF ( schema_name IS NOT NULL AND schema_name != '' ) THEN
+ sql := 'SELECT nspname FROM pg_namespace ' ||
+ 'WHERE text(nspname) = ' || quote_literal(schema_name) ||
+ 'LIMIT 1';
+ RAISE DEBUG '%', sql;
+ EXECUTE sql INTO real_schema;
- IF ( real_schema IS NULL ) THEN
- RAISE DEBUG 'Detecting schema';
- sql := 'SELECT n.nspname AS schemaname ' ||
- 'FROM pg_catalog.pg_class c ' ||
- 'JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace ' ||
- 'WHERE c.relkind = ' || quote_literal('r') ||
- ' AND n.nspname NOT IN (' || quote_literal('pg_catalog') || ', ' || quote_literal('pg_toast') || ')' ||
- ' AND pg_catalog.pg_table_is_visible(c.oid)' ||
- ' AND c.relname = ' || quote_literal(table_name);
- RAISE DEBUG '%', sql;
- EXECUTE sql INTO real_schema;
-
- IF ( real_schema IS NULL ) THEN
- RAISE EXCEPTION 'Table % does not occur in the search_path', quote_literal(table_name);
- RETURN 'fail';
- END IF;
- END IF;
+ IF ( real_schema IS NULL ) THEN
+ RAISE EXCEPTION 'Schema % is not a valid schemaname', quote_literal(schema_name);
+ RETURN 'fail';
+ END IF;
+ END IF;
+
+ IF ( real_schema IS NULL ) THEN
+ RAISE DEBUG 'Detecting schema';
+ sql := 'SELECT n.nspname AS schemaname ' ||
+ 'FROM pg_catalog.pg_class c ' ||
+ 'JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace ' ||
+ 'WHERE c.relkind = ' || quote_literal('r') ||
+ ' AND n.nspname NOT IN (' || quote_literal('pg_catalog') || ', ' || quote_literal('pg_toast') || ')' ||
+ ' AND pg_catalog.pg_table_is_visible(c.oid)' ||
+ ' AND c.relname = ' || quote_literal(table_name);
+ RAISE DEBUG '%', sql;
+ EXECUTE sql INTO real_schema;
+
+ IF ( real_schema IS NULL ) THEN
+ RAISE EXCEPTION 'Table % does not occur in the search_path', quote_literal(table_name);
+ RETURN 'fail';
+ END IF;
+ END IF;
- -- Add geometry column to table
- IF use_typmod THEN
- sql := 'ALTER TABLE ' ||
+ -- Add geometry column to table
+ IF use_typmod THEN
+ sql := 'ALTER TABLE ' ||
quote_ident(real_schema) || '.' || quote_ident(table_name)
|| ' ADD COLUMN ' || quote_ident(column_name) ||
' geometry(' || postgis_type_name(new_type, new_dim) || ', ' || new_srid::text || ')';
RAISE DEBUG '%', sql;
- ELSE
+ ELSE
sql := 'ALTER TABLE ' ||
quote_ident(real_schema) || '.' || quote_ident(table_name)
|| ' ADD COLUMN ' || quote_ident(column_name) ||
' geometry ';
RAISE DEBUG '%', sql;
END IF;
- EXECUTE sql;
+ EXECUTE sql;
- IF NOT use_typmod THEN
+ IF NOT use_typmod THEN
-- Add table CHECKs
sql := 'ALTER TABLE ' ||
quote_ident(real_schema) || '.' || quote_ident(table_name)
@@ -1256,7 +1256,7 @@ BEGIN
') = ' || new_srid::text || ')' ;
RAISE DEBUG '%', sql;
EXECUTE sql;
-
+
sql := 'ALTER TABLE ' ||
quote_ident(real_schema) || '.' || quote_ident(table_name)
|| ' ADD CONSTRAINT '
@@ -1265,7 +1265,7 @@ BEGIN
') = ' || new_dim::text || ')' ;
RAISE DEBUG '%', sql;
EXECUTE sql;
-
+
IF ( NOT (new_type = 'GEOMETRY')) THEN
sql := 'ALTER TABLE ' ||
quote_ident(real_schema) || '.' || quote_ident(table_name) || ' ADD CONSTRAINT ' ||
@@ -1279,131 +1279,131 @@ BEGIN
END IF;
END IF;
- RETURN
- real_schema || '.' ||
- table_name || '.' || column_name ||
- ' SRID:' || new_srid::text ||
- ' TYPE:' || new_type ||
- ' DIMS:' || new_dim::text || ' ';
+ RETURN
+ real_schema || '.' ||
+ table_name || '.' || column_name ||
+ ' SRID:' || new_srid::text ||
+ ' TYPE:' || new_type ||
+ ' DIMS:' || new_dim::text || ' ';
END;
$$
LANGUAGE 'plpgsql' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION AddGeometryColumn(schema_name varchar,table_name varchar,column_name varchar,new_srid integer,new_type varchar,new_dim integer, use_typmod boolean DEFAULT true) RETURNS text AS $$
DECLARE
- ret text;
+ ret text;
BEGIN
- SELECT AddGeometryColumn('',$1,$2,$3,$4,$5,$6,$7) into ret;
- RETURN ret;
+ SELECT AddGeometryColumn('',$1,$2,$3,$4,$5,$6,$7) into ret;
+ RETURN ret;
END;
$$
LANGUAGE 'plpgsql' STABLE STRICT;
CREATE OR REPLACE FUNCTION AddGeometryColumn(table_name varchar,column_name varchar,new_srid integer,new_type varchar,new_dim integer, use_typmod boolean DEFAULT true) RETURNS text AS $$
DECLARE
- ret text;
+ ret text;
BEGIN
- SELECT AddGeometryColumn('','',$1,$2,$3,$4,$5, $6) into ret;
- RETURN ret;
+ SELECT AddGeometryColumn('','',$1,$2,$3,$4,$5, $6) into ret;
+ RETURN ret;
END;
$$
LANGUAGE 'plpgsql' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION DropGeometryColumn(catalog_name varchar, schema_name varchar,table_name varchar,column_name varchar)
- RETURNS text
- AS
+ RETURNS text
+ AS
$$
DECLARE
- myrec RECORD;
- okay boolean;
- real_schema name;
+ myrec RECORD;
+ okay boolean;
+ real_schema name;
BEGIN
- -- Find, check or fix schema_name
- IF ( schema_name != '' ) THEN
- okay = false;
-
- FOR myrec IN SELECT nspname FROM pg_namespace WHERE text(nspname) = schema_name LOOP
- okay := true;
- END LOOP;
-
- IF ( okay <> true ) THEN
- RAISE NOTICE 'Invalid schema name - using current_schema()';
- SELECT current_schema() into real_schema;
- ELSE
- real_schema = schema_name;
- END IF;
- ELSE
- SELECT current_schema() into real_schema;
- END IF;
-
- -- Find out if the column is in the geometry_columns table
- okay = false;
- FOR myrec IN SELECT * from geometry_columns where f_table_schema = text(real_schema) and f_table_name = table_name and f_geometry_column = column_name LOOP
- okay := true;
- END LOOP;
- IF (okay <> true) THEN
- RAISE EXCEPTION 'column not found in geometry_columns table';
- RETURN false;
- END IF;
+ -- Find, check or fix schema_name
+ IF ( schema_name != '' ) THEN
+ okay = false;
- -- Remove table column
- EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) || '.' ||
- quote_ident(table_name) || ' DROP COLUMN ' ||
- quote_ident(column_name);
+ FOR myrec IN SELECT nspname FROM pg_namespace WHERE text(nspname) = schema_name LOOP
+ okay := true;
+ END LOOP;
- RETURN real_schema || '.' || table_name || '.' || column_name ||' effectively removed.';
+ IF ( okay <> true ) THEN
+ RAISE NOTICE 'Invalid schema name - using current_schema()';
+ SELECT current_schema() into real_schema;
+ ELSE
+ real_schema = schema_name;
+ END IF;
+ ELSE
+ SELECT current_schema() into real_schema;
+ END IF;
+
+ -- Find out if the column is in the geometry_columns table
+ okay = false;
+ FOR myrec IN SELECT * from geometry_columns where f_table_schema = text(real_schema) and f_table_name = table_name and f_geometry_column = column_name LOOP
+ okay := true;
+ END LOOP;
+ IF (okay <> true) THEN
+ RAISE EXCEPTION 'column not found in geometry_columns table';
+ RETURN false;
+ END IF;
+
+ -- Remove table column
+ EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) || '.' ||
+ quote_ident(table_name) || ' DROP COLUMN ' ||
+ quote_ident(column_name);
+
+ RETURN real_schema || '.' || table_name || '.' || column_name ||' effectively removed.';
END;
$$
LANGUAGE 'plpgsql' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION DropGeometryColumn(schema_name varchar, table_name varchar,column_name varchar)
- RETURNS text
- AS
+ RETURNS text
+ AS
$$
DECLARE
- ret text;
+ ret text;
BEGIN
- SELECT DropGeometryColumn('',$1,$2,$3) into ret;
- RETURN ret;
+ SELECT DropGeometryColumn('',$1,$2,$3) into ret;
+ RETURN ret;
END;
$$
LANGUAGE 'plpgsql' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION DropGeometryColumn(table_name varchar, column_name varchar)
- RETURNS text
- AS
+ RETURNS text
+ AS
$$
DECLARE
- ret text;
+ ret text;
BEGIN
- SELECT DropGeometryColumn('','',$1,$2) into ret;
- RETURN ret;
+ SELECT DropGeometryColumn('','',$1,$2) into ret;
+ RETURN ret;
END;
$$
LANGUAGE 'plpgsql' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION DropGeometryTable(catalog_name varchar, schema_name varchar, table_name varchar)
- RETURNS text
- AS
+ RETURNS text
+ AS
$$
DECLARE
- real_schema name;
+ real_schema name;
BEGIN
- IF ( schema_name = '' ) THEN
- SELECT current_schema() into real_schema;
- ELSE
- real_schema = schema_name;
- END IF;
+ IF ( schema_name = '' ) THEN
+ SELECT current_schema() into real_schema;
+ ELSE
+ real_schema = schema_name;
+ END IF;
- -- TODO: Should we warn if table doesn't exist probably instead just saying dropped
- -- Remove table
- EXECUTE 'DROP TABLE IF EXISTS '
- || quote_ident(real_schema) || '.' ||
- quote_ident(table_name) || ' RESTRICT';
+ -- TODO: Should we warn if table doesn't exist probably instead just saying dropped
+ -- Remove table
+ EXECUTE 'DROP TABLE IF EXISTS '
+ || quote_ident(real_schema) || '.' ||
+ quote_ident(table_name) || ' RESTRICT';
- RETURN
- real_schema || '.' ||
- table_name ||' dropped.';
+ RETURN
+ real_schema || '.' ||
+ table_name ||' dropped.';
END;
$$
@@ -1415,365 +1415,365 @@ CREATE OR REPLACE FUNCTION DropGeometryTable(table_name varchar) RETURNS text AS
$$ SELECT DropGeometryTable('','',$1) $$
LANGUAGE 'sql' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION UpdateGeometrySRID(catalogn_name varchar,schema_name varchar,table_name varchar,column_name varchar,new_srid_in integer)
- RETURNS text
- AS
+ RETURNS text
+ AS
$$
DECLARE
- myrec RECORD;
- okay boolean;
- cname varchar;
- real_schema name;
- unknown_srid integer;
- new_srid integer := new_srid_in;
+ myrec RECORD;
+ okay boolean;
+ cname varchar;
+ real_schema name;
+ unknown_srid integer;
+ new_srid integer := new_srid_in;
BEGIN
- -- Find, check or fix schema_name
- IF ( schema_name != '' ) THEN
- okay = false;
-
- FOR myrec IN SELECT nspname FROM pg_namespace WHERE text(nspname) = schema_name LOOP
- okay := true;
- END LOOP;
-
- IF ( okay <> true ) THEN
- RAISE EXCEPTION 'Invalid schema name';
- ELSE
- real_schema = schema_name;
- END IF;
- ELSE
- SELECT INTO real_schema current_schema()::text;
- END IF;
+ -- Find, check or fix schema_name
+ IF ( schema_name != '' ) THEN
+ okay = false;
- -- Ensure that column_name is in geometry_columns
- okay = false;
- FOR myrec IN SELECT type, coord_dimension FROM geometry_columns WHERE f_table_schema = text(real_schema) and f_table_name = table_name and f_geometry_column = column_name LOOP
- okay := true;
- END LOOP;
- IF (NOT okay) THEN
- RAISE EXCEPTION 'column not found in geometry_columns table';
- RETURN false;
- END IF;
+ FOR myrec IN SELECT nspname FROM pg_namespace WHERE text(nspname) = schema_name LOOP
+ okay := true;
+ END LOOP;
- -- Ensure that new_srid is valid
- IF ( new_srid > 0 ) THEN
- IF ( SELECT count(*) = 0 from spatial_ref_sys where srid = new_srid ) THEN
- RAISE EXCEPTION 'invalid SRID: % not found in spatial_ref_sys', new_srid;
- RETURN false;
- END IF;
- ELSE
- unknown_srid := ST_SRID('POINT EMPTY'::geometry);
- IF ( new_srid != unknown_srid ) THEN
- new_srid := unknown_srid;
- RAISE NOTICE 'SRID value % converted to the officially unknown SRID value %', new_srid_in, new_srid;
- END IF;
- END IF;
+ IF ( okay <> true ) THEN
+ RAISE EXCEPTION 'Invalid schema name';
+ ELSE
+ real_schema = schema_name;
+ END IF;
+ ELSE
+ SELECT INTO real_schema current_schema()::text;
+ END IF;
+
+ -- Ensure that column_name is in geometry_columns
+ okay = false;
+ FOR myrec IN SELECT type, coord_dimension FROM geometry_columns WHERE f_table_schema = text(real_schema) and f_table_name = table_name and f_geometry_column = column_name LOOP
+ okay := true;
+ END LOOP;
+ IF (NOT okay) THEN
+ RAISE EXCEPTION 'column not found in geometry_columns table';
+ RETURN false;
+ END IF;
+
+ -- Ensure that new_srid is valid
+ IF ( new_srid > 0 ) THEN
+ IF ( SELECT count(*) = 0 from spatial_ref_sys where srid = new_srid ) THEN
+ RAISE EXCEPTION 'invalid SRID: % not found in spatial_ref_sys', new_srid;
+ RETURN false;
+ END IF;
+ ELSE
+ unknown_srid := ST_SRID('POINT EMPTY'::geometry);
+ IF ( new_srid != unknown_srid ) THEN
+ new_srid := unknown_srid;
+ RAISE NOTICE 'SRID value % converted to the officially unknown SRID value %', new_srid_in, new_srid;
+ END IF;
+ END IF;
- IF postgis_constraint_srid(schema_name, table_name, column_name) IS NOT NULL THEN
- -- srid was enforced with constraints before, keep it that way.
+ IF postgis_constraint_srid(schema_name, table_name, column_name) IS NOT NULL THEN
+ -- srid was enforced with constraints before, keep it that way.
-- Make up constraint name
- cname = 'enforce_srid_' || column_name;
-
+ cname = 'enforce_srid_' || column_name;
+
-- Drop enforce_srid constraint
EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) ||
'.' || quote_ident(table_name) ||
' DROP constraint ' || quote_ident(cname);
-
+
-- Update geometries SRID
EXECUTE 'UPDATE ' || quote_ident(real_schema) ||
'.' || quote_ident(table_name) ||
' SET ' || quote_ident(column_name) ||
' = ST_SetSRID(' || quote_ident(column_name) ||
', ' || new_srid::text || ')';
-
+
-- Reset enforce_srid constraint
EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) ||
'.' || quote_ident(table_name) ||
' ADD constraint ' || quote_ident(cname) ||
' CHECK (st_srid(' || quote_ident(column_name) ||
') = ' || new_srid::text || ')';
- ELSE
+ ELSE
-- We will use typmod to enforce if no srid constraints
- -- We are using postgis_type_name to lookup the new name
- -- (in case Paul changes his mind and flips geometry_columns to return old upper case name)
- EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) || '.' || quote_ident(table_name) ||
+ -- We are using postgis_type_name to lookup the new name
+ -- (in case Paul changes his mind and flips geometry_columns to return old upper case name)
+ EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) || '.' || quote_ident(table_name) ||
' ALTER COLUMN ' || quote_ident(column_name) || ' TYPE geometry(' || postgis_type_name(myrec.type, myrec.coord_dimension, true) || ', ' || new_srid::text || ') USING ST_SetSRID(' || quote_ident(column_name) || ',' || new_srid::text || ');' ;
END IF;
- RETURN real_schema || '.' || table_name || '.' || column_name ||' SRID changed to ' || new_srid::text;
+ RETURN real_schema || '.' || table_name || '.' || column_name ||' SRID changed to ' || new_srid::text;
END;
$$
LANGUAGE 'plpgsql' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION UpdateGeometrySRID(varchar,varchar,varchar,integer)
- RETURNS text
- AS $$
+ RETURNS text
+ AS $$
DECLARE
- ret text;
+ ret text;
BEGIN
- SELECT UpdateGeometrySRID('',$1,$2,$3,$4) into ret;
- RETURN ret;
+ SELECT UpdateGeometrySRID('',$1,$2,$3,$4) into ret;
+ RETURN ret;
END;
$$
LANGUAGE 'plpgsql' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION UpdateGeometrySRID(varchar,varchar,integer)
- RETURNS text
- AS $$
+ RETURNS text
+ AS $$
DECLARE
- ret text;
+ ret text;
BEGIN
- SELECT UpdateGeometrySRID('','',$1,$2,$3) into ret;
- RETURN ret;
+ SELECT UpdateGeometrySRID('','',$1,$2,$3) into ret;
+ RETURN ret;
END;
$$
LANGUAGE 'plpgsql' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION find_srid(varchar,varchar,varchar) RETURNS int4 AS
$$
DECLARE
- schem text;
- tabl text;
- sr int4;
+ schem text;
+ tabl text;
+ sr int4;
BEGIN
- IF $1 IS NULL THEN
- RAISE EXCEPTION 'find_srid() - schema is NULL!';
- END IF;
- IF $2 IS NULL THEN
- RAISE EXCEPTION 'find_srid() - table name is NULL!';
- END IF;
- IF $3 IS NULL THEN
- RAISE EXCEPTION 'find_srid() - column name is NULL!';
- END IF;
- schem = $1;
- tabl = $2;
+ IF $1 IS NULL THEN
+ RAISE EXCEPTION 'find_srid() - schema is NULL!';
+ END IF;
+ IF $2 IS NULL THEN
+ RAISE EXCEPTION 'find_srid() - table name is NULL!';
+ END IF;
+ IF $3 IS NULL THEN
+ RAISE EXCEPTION 'find_srid() - column name is NULL!';
+ END IF;
+ schem = $1;
+ tabl = $2;
-- if the table contains a . and the schema is empty
-- split the table into a schema and a table
-- otherwise drop through to default behavior
- IF ( schem = '' and tabl LIKE '%.%' ) THEN
- schem = substr(tabl,1,strpos(tabl,'.')-1);
- tabl = substr(tabl,length(schem)+2);
- ELSE
- schem = schem || '%';
- END IF;
-
- select SRID into sr from geometry_columns where f_table_schema like schem and f_table_name = tabl and f_geometry_column = $3;
- IF NOT FOUND THEN
- RAISE EXCEPTION 'find_srid() - couldnt find the corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS table? Is there an uppercase/lowercase missmatch?';
- END IF;
- return sr;
+ IF ( schem = '' and tabl LIKE '%.%' ) THEN
+ schem = substr(tabl,1,strpos(tabl,'.')-1);
+ tabl = substr(tabl,length(schem)+2);
+ ELSE
+ schem = schem || '%';
+ END IF;
+
+ select SRID into sr from geometry_columns where f_table_schema like schem and f_table_name = tabl and f_geometry_column = $3;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'find_srid() - couldnt find the corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS table? Is there an uppercase/lowercase missmatch?';
+ END IF;
+ return sr;
END;
$$
LANGUAGE 'plpgsql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION get_proj4_from_srid(integer) RETURNS text AS
$$
BEGIN
- RETURN proj4text::text FROM spatial_ref_sys WHERE srid= $1;
+ RETURN proj4text::text FROM spatial_ref_sys WHERE srid= $1;
END;
$$
LANGUAGE 'plpgsql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION postgis_transform_geometry(geometry,text,text,int)
- RETURNS geometry
- AS '$libdir/postgis-2.0','transform_geom'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','transform_geom'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Transform(geometry,integer)
- RETURNS geometry
- AS '$libdir/postgis-2.0','transform'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','transform'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION postgis_version() RETURNS text
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c' IMMUTABLE;
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_proj_version() RETURNS text
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c' IMMUTABLE;
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_scripts_installed() RETURNS text
- AS $$ SELECT '2.0.2'::text || ' r' || 10789::text AS version $$
- LANGUAGE 'sql' IMMUTABLE;
+ AS $$ SELECT '2.0.2'::text || ' r' || 10789::text AS version $$
+ LANGUAGE 'sql' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_lib_version() RETURNS text
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c' IMMUTABLE; -- a new lib will require a new session
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c' IMMUTABLE; -- a new lib will require a new session
CREATE OR REPLACE FUNCTION postgis_scripts_released() RETURNS text
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c' IMMUTABLE;
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_geos_version() RETURNS text
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c' IMMUTABLE;
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_svn_version() RETURNS text
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c' IMMUTABLE;
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_libxml_version() RETURNS text
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c' IMMUTABLE;
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_scripts_build_date() RETURNS text
- AS 'SELECT ''2012-12-05 22:40:44''::text AS version'
- LANGUAGE 'sql' IMMUTABLE;
+ AS 'SELECT ''2012-12-05 22:46:23''::text AS version'
+ LANGUAGE 'sql' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_lib_build_date() RETURNS text
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c' IMMUTABLE;
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_full_version() RETURNS text
AS $$
DECLARE
- libver text;
- svnver text;
- projver text;
- geosver text;
- gdalver text;
- libxmlver text;
- dbproc text;
- relproc text;
- fullver text;
- rast_lib_ver text;
- rast_scr_ver text;
- topo_scr_ver text;
- json_lib_ver text;
+ libver text;
+ svnver text;
+ projver text;
+ geosver text;
+ gdalver text;
+ libxmlver text;
+ dbproc text;
+ relproc text;
+ fullver text;
+ rast_lib_ver text;
+ rast_scr_ver text;
+ topo_scr_ver text;
+ json_lib_ver text;
BEGIN
- SELECT postgis_lib_version() INTO libver;
- SELECT postgis_proj_version() INTO projver;
- SELECT postgis_geos_version() INTO geosver;
- SELECT postgis_libjson_version() INTO json_lib_ver;
- BEGIN
- SELECT postgis_gdal_version() INTO gdalver;
- EXCEPTION
- WHEN undefined_function THEN
- gdalver := NULL;
- RAISE NOTICE 'Function postgis_gdal_version() not found. Is raster support enabled and rtpostgis.sql installed?';
- END;
- SELECT postgis_libxml_version() INTO libxmlver;
- SELECT postgis_scripts_installed() INTO dbproc;
- SELECT postgis_scripts_released() INTO relproc;
- select postgis_svn_version() INTO svnver;
- BEGIN
- SELECT postgis_topology_scripts_installed() INTO topo_scr_ver;
- EXCEPTION
- WHEN undefined_function THEN
- topo_scr_ver := NULL;
- RAISE NOTICE 'Function postgis_topology_scripts_installed() not found. Is topology support enabled and topology.sql installed?';
- END;
-
- BEGIN
- SELECT postgis_raster_scripts_installed() INTO rast_scr_ver;
- EXCEPTION
- WHEN undefined_function THEN
- rast_scr_ver := NULL;
- RAISE NOTICE 'Function postgis_raster_scripts_installed() not found. Is raster support enabled and rtpostgis.sql installed?';
- END;
-
- BEGIN
- SELECT postgis_raster_lib_version() INTO rast_lib_ver;
- EXCEPTION
- WHEN undefined_function THEN
- rast_lib_ver := NULL;
- RAISE NOTICE 'Function postgis_raster_lib_version() not found. Is raster support enabled and rtpostgis.sql installed?';
- END;
-
- fullver = 'POSTGIS="' || libver;
-
- IF svnver IS NOT NULL THEN
- fullver = fullver || ' r' || svnver;
- END IF;
-
- fullver = fullver || '"';
-
- IF geosver IS NOT NULL THEN
- fullver = fullver || ' GEOS="' || geosver || '"';
- END IF;
-
- IF projver IS NOT NULL THEN
- fullver = fullver || ' PROJ="' || projver || '"';
- END IF;
-
- IF gdalver IS NOT NULL THEN
- fullver = fullver || ' GDAL="' || gdalver || '"';
- END IF;
-
- IF libxmlver IS NOT NULL THEN
- fullver = fullver || ' LIBXML="' || libxmlver || '"';
- END IF;
-
- IF json_lib_ver IS NOT NULL THEN
- fullver = fullver || ' LIBJSON="' || json_lib_ver || '"';
- END IF;
-
- -- fullver = fullver || ' DBPROC="' || dbproc || '"';
- -- fullver = fullver || ' RELPROC="' || relproc || '"';
-
- IF dbproc != relproc THEN
- fullver = fullver || ' (core procs from "' || dbproc || '" need upgrade)';
- END IF;
-
- IF topo_scr_ver IS NOT NULL THEN
- fullver = fullver || ' TOPOLOGY';
- IF topo_scr_ver != relproc THEN
- fullver = fullver || ' (topology procs from "' || topo_scr_ver || '" need upgrade)';
- END IF;
- END IF;
+ SELECT postgis_lib_version() INTO libver;
+ SELECT postgis_proj_version() INTO projver;
+ SELECT postgis_geos_version() INTO geosver;
+ SELECT postgis_libjson_version() INTO json_lib_ver;
+ BEGIN
+ SELECT postgis_gdal_version() INTO gdalver;
+ EXCEPTION
+ WHEN undefined_function THEN
+ gdalver := NULL;
+ RAISE NOTICE 'Function postgis_gdal_version() not found. Is raster support enabled and rtpostgis.sql installed?';
+ END;
+ SELECT postgis_libxml_version() INTO libxmlver;
+ SELECT postgis_scripts_installed() INTO dbproc;
+ SELECT postgis_scripts_released() INTO relproc;
+ select postgis_svn_version() INTO svnver;
+ BEGIN
+ SELECT postgis_topology_scripts_installed() INTO topo_scr_ver;
+ EXCEPTION
+ WHEN undefined_function THEN
+ topo_scr_ver := NULL;
+ RAISE NOTICE 'Function postgis_topology_scripts_installed() not found. Is topology support enabled and topology.sql installed?';
+ END;
+
+ BEGIN
+ SELECT postgis_raster_scripts_installed() INTO rast_scr_ver;
+ EXCEPTION
+ WHEN undefined_function THEN
+ rast_scr_ver := NULL;
+ RAISE NOTICE 'Function postgis_raster_scripts_installed() not found. Is raster support enabled and rtpostgis.sql installed?';
+ END;
+
+ BEGIN
+ SELECT postgis_raster_lib_version() INTO rast_lib_ver;
+ EXCEPTION
+ WHEN undefined_function THEN
+ rast_lib_ver := NULL;
+ RAISE NOTICE 'Function postgis_raster_lib_version() not found. Is raster support enabled and rtpostgis.sql installed?';
+ END;
+
+ fullver = 'POSTGIS="' || libver;
+
+ IF svnver IS NOT NULL THEN
+ fullver = fullver || ' r' || svnver;
+ END IF;
+
+ fullver = fullver || '"';
+
+ IF geosver IS NOT NULL THEN
+ fullver = fullver || ' GEOS="' || geosver || '"';
+ END IF;
+
+ IF projver IS NOT NULL THEN
+ fullver = fullver || ' PROJ="' || projver || '"';
+ END IF;
+
+ IF gdalver IS NOT NULL THEN
+ fullver = fullver || ' GDAL="' || gdalver || '"';
+ END IF;
+
+ IF libxmlver IS NOT NULL THEN
+ fullver = fullver || ' LIBXML="' || libxmlver || '"';
+ END IF;
+
+ IF json_lib_ver IS NOT NULL THEN
+ fullver = fullver || ' LIBJSON="' || json_lib_ver || '"';
+ END IF;
+
+ -- fullver = fullver || ' DBPROC="' || dbproc || '"';
+ -- fullver = fullver || ' RELPROC="' || relproc || '"';
+
+ IF dbproc != relproc THEN
+ fullver = fullver || ' (core procs from "' || dbproc || '" need upgrade)';
+ END IF;
+
+ IF topo_scr_ver IS NOT NULL THEN
+ fullver = fullver || ' TOPOLOGY';
+ IF topo_scr_ver != relproc THEN
+ fullver = fullver || ' (topology procs from "' || topo_scr_ver || '" need upgrade)';
+ END IF;
+ END IF;
- IF rast_lib_ver IS NOT NULL THEN
- fullver = fullver || ' RASTER';
- IF rast_lib_ver != relproc THEN
- fullver = fullver || ' (raster lib from "' || rast_lib_ver || '" need upgrade)';
- END IF;
- END IF;
+ IF rast_lib_ver IS NOT NULL THEN
+ fullver = fullver || ' RASTER';
+ IF rast_lib_ver != relproc THEN
+ fullver = fullver || ' (raster lib from "' || rast_lib_ver || '" need upgrade)';
+ END IF;
+ END IF;
- IF rast_scr_ver IS NOT NULL AND rast_scr_ver != relproc THEN
- fullver = fullver || ' (raster procs from "' || rast_scr_ver || '" need upgrade)';
- END IF;
+ IF rast_scr_ver IS NOT NULL AND rast_scr_ver != relproc THEN
+ fullver = fullver || ' (raster procs from "' || rast_scr_ver || '" need upgrade)';
+ END IF;
- RETURN fullver;
+ RETURN fullver;
END
$$
LANGUAGE 'plpgsql' IMMUTABLE;
CREATE OR REPLACE FUNCTION box2d(geometry)
- RETURNS box2d
- AS '$libdir/postgis-2.0','LWGEOM_to_BOX2D'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box2d
+ AS '$libdir/postgis-2.0','LWGEOM_to_BOX2D'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box3d(geometry)
- RETURNS box3d
- AS '$libdir/postgis-2.0','LWGEOM_to_BOX3D'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box3d
+ AS '$libdir/postgis-2.0','LWGEOM_to_BOX3D'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box(geometry)
- RETURNS box
- AS '$libdir/postgis-2.0','LWGEOM_to_BOX'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box
+ AS '$libdir/postgis-2.0','LWGEOM_to_BOX'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box2d(box3d)
- RETURNS box2d
- AS '$libdir/postgis-2.0','BOX3D_to_BOX2D'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box2d
+ AS '$libdir/postgis-2.0','BOX3D_to_BOX2D'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box3d(box2d)
- RETURNS box3d
- AS '$libdir/postgis-2.0','BOX2D_to_BOX3D'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box3d
+ AS '$libdir/postgis-2.0','BOX2D_to_BOX3D'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box(box3d)
- RETURNS box
- AS '$libdir/postgis-2.0','BOX3D_to_BOX'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS box
+ AS '$libdir/postgis-2.0','BOX3D_to_BOX'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION text(geometry)
- RETURNS text
- AS '$libdir/postgis-2.0','LWGEOM_to_text'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS text
+ AS '$libdir/postgis-2.0','LWGEOM_to_text'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION box3dtobox(box3d)
- RETURNS box
- AS 'SELECT box($1)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS box
+ AS 'SELECT box($1)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry(box2d)
- RETURNS geometry
- AS '$libdir/postgis-2.0','BOX2D_to_LWGEOM'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','BOX2D_to_LWGEOM'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry(box3d)
- RETURNS geometry
- AS '$libdir/postgis-2.0','BOX3D_to_LWGEOM'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','BOX3D_to_LWGEOM'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry(text)
- RETURNS geometry
- AS '$libdir/postgis-2.0','parse_WKT_lwgeom'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','parse_WKT_lwgeom'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION geometry(bytea)
- RETURNS geometry
- AS '$libdir/postgis-2.0','LWGEOM_from_bytea'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','LWGEOM_from_bytea'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION bytea(geometry)
- RETURNS bytea
- AS '$libdir/postgis-2.0','LWGEOM_to_bytea'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS bytea
+ AS '$libdir/postgis-2.0','LWGEOM_to_bytea'
+ LANGUAGE 'c' IMMUTABLE STRICT;
DROP CAST IF EXISTS (geometry AS box2d);
CREATE CAST (geometry AS box2d) WITH FUNCTION box2d(geometry) AS IMPLICIT;
DROP CAST IF EXISTS (geometry AS box3d);
@@ -1799,169 +1799,169 @@ CREATE CAST (bytea AS geometry) WITH FUNCTION geometry(bytea) AS IMPLICIT;
DROP CAST IF EXISTS (geometry AS bytea);
CREATE CAST (geometry AS bytea) WITH FUNCTION bytea(geometry) AS IMPLICIT;
CREATE OR REPLACE FUNCTION ST_Simplify(geometry, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_simplify2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_simplify2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_SnapToGrid(geometry, float8, float8, float8, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_snaptogrid'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_snaptogrid'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_SnapToGrid(geometry, float8, float8)
- RETURNS geometry
- AS 'SELECT ST_SnapToGrid($1, 0, 0, $2, $3)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_SnapToGrid($1, 0, 0, $2, $3)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_SnapToGrid(geometry, float8)
- RETURNS geometry
- AS 'SELECT ST_SnapToGrid($1, 0, 0, $2, $2)'
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS 'SELECT ST_SnapToGrid($1, 0, 0, $2, $2)'
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_SnapToGrid(geom1 geometry, geom2 geometry, float8, float8, float8, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_snaptogrid_pointoff'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_snaptogrid_pointoff'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Segmentize(geometry, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_segmentize2d'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_segmentize2d'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_line_interpolate_point(geometry, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_line_interpolate_point'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_line_interpolate_point'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_line_substring(geometry, float8, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_line_substring'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_line_substring'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_line_locate_point(geom1 geometry, geom2 geometry)
- RETURNS float8
- AS '$libdir/postgis-2.0', 'LWGEOM_line_locate_point'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS float8
+ AS '$libdir/postgis-2.0', 'LWGEOM_line_locate_point'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_locate_between_measures(geometry, float8, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_locate_between_m'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_locate_between_m'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_locate_along_measure(geometry, float8)
- RETURNS geometry
- AS $$ SELECT ST_locate_between_measures($1, $2, $2) $$
- LANGUAGE 'sql' IMMUTABLE STRICT;
-CREATE OR REPLACE FUNCTION ST_AddMeasure(geometry, float8, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'ST_AddMeasure'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS $$ SELECT ST_locate_between_measures($1, $2, $2) $$
+ LANGUAGE 'sql' IMMUTABLE STRICT;
+CREATE OR REPLACE FUNCTION ST_AddMeasure(geometry, float8, float8)
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'ST_AddMeasure'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Intersection(geom1 geometry, geom2 geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0','intersection'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','intersection'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_Buffer(geometry,float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0','buffer'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','buffer'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION _ST_Buffer(geometry,float8,cstring)
- RETURNS geometry
- AS '$libdir/postgis-2.0','buffer'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','buffer'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_Buffer(geometry,float8,integer)
- RETURNS geometry
- AS $$ SELECT _ST_Buffer($1, $2,
- CAST('quad_segs='||CAST($3 AS text) as cstring))
- $$
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS $$ SELECT _ST_Buffer($1, $2,
+ CAST('quad_segs='||CAST($3 AS text) as cstring))
+ $$
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Buffer(geometry,float8,text)
- RETURNS geometry
- AS $$ SELECT _ST_Buffer($1, $2,
- CAST( regexp_replace($3, '^[0123456789]+$',
- 'quad_segs='||$3) AS cstring)
- )
- $$
- LANGUAGE 'sql' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS $$ SELECT _ST_Buffer($1, $2,
+ CAST( regexp_replace($3, '^[0123456789]+$',
+ 'quad_segs='||$3) AS cstring)
+ )
+ $$
+ LANGUAGE 'sql' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_OffsetCurve(line geometry, distance float8, params text DEFAULT '')
RETURNS geometry
AS '$libdir/postgis-2.0','ST_OffsetCurve'
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
CREATE OR REPLACE FUNCTION ST_ConvexHull(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0','convexhull'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','convexhull'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION _ST_LineCrossingDirection(geom1 geometry, geom2 geometry)
- RETURNS integer
- AS '$libdir/postgis-2.0', 'ST_LineCrossingDirection'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS integer
+ AS '$libdir/postgis-2.0', 'ST_LineCrossingDirection'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_LineCrossingDirection(geom1 geometry, geom2 geometry)
- RETURNS integer AS
- $$ SELECT CASE WHEN NOT $1 && $2 THEN 0 ELSE _ST_LineCrossingDirection($1,$2) END $$
- LANGUAGE 'sql' IMMUTABLE;
+ RETURNS integer AS
+ $$ SELECT CASE WHEN NOT $1 && $2 THEN 0 ELSE _ST_LineCrossingDirection($1,$2) END $$
+ LANGUAGE 'sql' IMMUTABLE;
CREATE OR REPLACE FUNCTION ST_SimplifyPreserveTopology(geometry, float8)
- RETURNS geometry
- AS '$libdir/postgis-2.0','topologypreservesimplify'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','topologypreservesimplify'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_IsValidReason(geometry)
- RETURNS text
- AS '$libdir/postgis-2.0', 'isvalidreason'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS text
+ AS '$libdir/postgis-2.0', 'isvalidreason'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_IsValidDetail(geometry)
- RETURNS valid_detail
- AS '$libdir/postgis-2.0', 'isvaliddetail'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS valid_detail
+ AS '$libdir/postgis-2.0', 'isvaliddetail'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_IsValidDetail(geometry, int4)
- RETURNS valid_detail
- AS '$libdir/postgis-2.0', 'isvaliddetail'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS valid_detail
+ AS '$libdir/postgis-2.0', 'isvaliddetail'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_IsValidReason(geometry, int4)
- RETURNS text
- AS $$
+ RETURNS text
+ AS $$
SELECT CASE WHEN valid THEN 'Valid Geometry' ELSE reason END FROM (
- SELECT (ST_isValidDetail($1, $2)).*
+ SELECT (ST_isValidDetail($1, $2)).*
) foo
- $$
- LANGUAGE 'sql' IMMUTABLE STRICT
- COST 100;
+ $$
+ LANGUAGE 'sql' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_IsValid(geometry, int4)
- RETURNS boolean
- AS 'SELECT (ST_isValidDetail($1, $2)).valid'
- LANGUAGE 'sql' IMMUTABLE STRICT
- COST 100;
+ RETURNS boolean
+ AS 'SELECT (ST_isValidDetail($1, $2)).valid'
+ LANGUAGE 'sql' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_HausdorffDistance(geom1 geometry, geom2 geometry)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0', 'hausdorffdistance'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0', 'hausdorffdistance'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_HausdorffDistance(geom1 geometry, geom2 geometry, float8)
- RETURNS FLOAT8
- AS '$libdir/postgis-2.0', 'hausdorffdistancedensify'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS FLOAT8
+ AS '$libdir/postgis-2.0', 'hausdorffdistancedensify'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_Difference(geom1 geometry, geom2 geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0','difference'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','difference'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Boundary(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0','boundary'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','boundary'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_SymDifference(geom1 geometry, geom2 geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0','symdifference'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','symdifference'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_symmetricdifference(geom1 geometry, geom2 geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0','symdifference'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','symdifference'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Union(geom1 geometry, geom2 geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0','geomunion'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','geomunion'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_UnaryUnion(geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0','ST_UnaryUnion'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','ST_UnaryUnion'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_RemoveRepeatedPoints(geometry)
RETURNS geometry
AS '$libdir/postgis-2.0', 'ST_RemoveRepeatedPoints'
@@ -2003,257 +2003,257 @@ CREATE OR REPLACE FUNCTION ST_Node(g geometry)
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
CREATE OR REPLACE FUNCTION ST_Combine_BBox(box3d,geometry)
- RETURNS box3d
- AS '$libdir/postgis-2.0', 'BOX3D_combine'
- LANGUAGE 'c' IMMUTABLE;
+ RETURNS box3d
+ AS '$libdir/postgis-2.0', 'BOX3D_combine'
+ LANGUAGE 'c' IMMUTABLE;
DROP AGGREGATE IF EXISTS ST_Extent(geometry);
CREATE AGGREGATE ST_Extent(
- sfunc = ST_combine_bbox,
- finalfunc = box2d,
- basetype = geometry,
- stype = box3d
- );
+ sfunc = ST_combine_bbox,
+ finalfunc = box2d,
+ basetype = geometry,
+ stype = box3d
+ );
DROP AGGREGATE IF EXISTS ST_3DExtent(geometry);
CREATE AGGREGATE ST_3DExtent(
- sfunc = ST_combine_bbox,
- basetype = geometry,
- stype = box3d
- );
+ sfunc = ST_combine_bbox,
+ basetype = geometry,
+ stype = box3d
+ );
CREATE OR REPLACE FUNCTION ST_Collect(geom1 geometry, geom2 geometry)
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_collect'
- LANGUAGE 'c' IMMUTABLE;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_collect'
+ LANGUAGE 'c' IMMUTABLE;
DROP AGGREGATE IF EXISTS ST_MemCollect(geometry);
CREATE AGGREGATE ST_MemCollect(
- sfunc = ST_collect,
- basetype = geometry,
- stype = geometry
- );
+ sfunc = ST_collect,
+ basetype = geometry,
+ stype = geometry
+ );
CREATE OR REPLACE FUNCTION ST_Collect(geometry[])
- RETURNS geometry
- AS '$libdir/postgis-2.0', 'LWGEOM_collect_garray'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0', 'LWGEOM_collect_garray'
+ LANGUAGE 'c' IMMUTABLE STRICT;
DROP AGGREGATE IF EXISTS ST_MemUnion(geometry);
CREATE AGGREGATE ST_MemUnion (
- basetype = geometry,
- sfunc = ST_Union,
- stype = geometry
- );
+ basetype = geometry,
+ sfunc = ST_Union,
+ stype = geometry
+ );
CREATE OR REPLACE FUNCTION pgis_abs_in(cstring)
- RETURNS pgis_abs
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS pgis_abs
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION pgis_abs_out(pgis_abs)
- RETURNS cstring
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS cstring
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION pgis_geometry_accum_transfn(pgis_abs, geometry)
- RETURNS pgis_abs
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c';
+ RETURNS pgis_abs
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c';
CREATE OR REPLACE FUNCTION pgis_geometry_accum_finalfn(pgis_abs)
- RETURNS geometry[]
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c';
+ RETURNS geometry[]
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c';
CREATE OR REPLACE FUNCTION pgis_geometry_union_finalfn(pgis_abs)
- RETURNS geometry
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c';
+ RETURNS geometry
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c';
CREATE OR REPLACE FUNCTION pgis_geometry_collect_finalfn(pgis_abs)
- RETURNS geometry
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c';
+ RETURNS geometry
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c';
CREATE OR REPLACE FUNCTION pgis_geometry_polygonize_finalfn(pgis_abs)
- RETURNS geometry
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c';
+ RETURNS geometry
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c';
CREATE OR REPLACE FUNCTION pgis_geometry_makeline_finalfn(pgis_abs)
- RETURNS geometry
- AS '$libdir/postgis-2.0'
- LANGUAGE 'c';
+ RETURNS geometry
+ AS '$libdir/postgis-2.0'
+ LANGUAGE 'c';
DROP AGGREGATE IF EXISTS ST_Accum(geometry);
CREATE AGGREGATE ST_Accum (
- sfunc = pgis_geometry_accum_transfn,
- basetype = geometry,
- stype = pgis_abs,
- finalfunc = pgis_geometry_accum_finalfn
- );
+ sfunc = pgis_geometry_accum_transfn,
+ basetype = geometry,
+ stype = pgis_abs,
+ finalfunc = pgis_geometry_accum_finalfn
+ );
CREATE OR REPLACE FUNCTION ST_Union (geometry[])
- RETURNS geometry
- AS '$libdir/postgis-2.0','pgis_union_geometry_array'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS geometry
+ AS '$libdir/postgis-2.0','pgis_union_geometry_array'
+ LANGUAGE 'c' IMMUTABLE STRICT;
DROP AGGREGATE IF EXISTS ST_Union(geometry);
CREATE AGGREGATE ST_Union (
- basetype = geometry,
- sfunc = pgis_geometry_accum_transfn,
- stype = pgis_abs,
- finalfunc = pgis_geometry_union_finalfn
- );
+ basetype = geometry,
+ sfunc = pgis_geometry_accum_transfn,
+ stype = pgis_abs,
+ finalfunc = pgis_geometry_union_finalfn
+ );
DROP AGGREGATE IF EXISTS ST_Collect(geometry);
CREATE AGGREGATE ST_Collect (
- BASETYPE = geometry,
- SFUNC = pgis_geometry_accum_transfn,
- STYPE = pgis_abs,
- FINALFUNC = pgis_geometry_collect_finalfn
- );
+ BASETYPE = geometry,
+ SFUNC = pgis_geometry_accum_transfn,
+ STYPE = pgis_abs,
+ FINALFUNC = pgis_geometry_collect_finalfn
+ );
DROP AGGREGATE IF EXISTS ST_Polygonize(geometry);
CREATE AGGREGATE ST_Polygonize (
- BASETYPE = geometry,
- SFUNC = pgis_geometry_accum_transfn,
- STYPE = pgis_abs,
- FINALFUNC = pgis_geometry_polygonize_finalfn
- );
+ BASETYPE = geometry,
+ SFUNC = pgis_geometry_accum_transfn,
+ STYPE = pgis_abs,
+ FINALFUNC = pgis_geometry_polygonize_finalfn
+ );
DROP AGGREGATE IF EXISTS ST_MakeLine(geometry);
CREATE AGGREGATE ST_MakeLine (
- BASETYPE = geometry,
- SFUNC = pgis_geometry_accum_transfn,
- STYPE = pgis_abs,
- FINALFUNC = pgis_geometry_makeline_finalfn
- );
+ BASETYPE = geometry,
+ SFUNC = pgis_geometry_accum_transfn,
+ STYPE = pgis_abs,
+ FINALFUNC = pgis_geometry_makeline_finalfn
+ );
CREATE OR REPLACE FUNCTION ST_Relate(geom1 geometry, geom2 geometry)
- RETURNS text
- AS '$libdir/postgis-2.0','relate_full'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS text
+ AS '$libdir/postgis-2.0','relate_full'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Relate(geom1 geometry, geom2 geometry, int4)
- RETURNS text
- AS '$libdir/postgis-2.0','relate_full'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS text
+ AS '$libdir/postgis-2.0','relate_full'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Relate(geom1 geometry, geom2 geometry,text)
- RETURNS boolean
- AS '$libdir/postgis-2.0','relate_pattern'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS boolean
+ AS '$libdir/postgis-2.0','relate_pattern'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION ST_Disjoint(geom1 geometry, geom2 geometry)
- RETURNS boolean
- AS '$libdir/postgis-2.0','disjoint'
- LANGUAGE 'c' IMMUTABLE STRICT;
+ RETURNS boolean
+ AS '$libdir/postgis-2.0','disjoint'
+ LANGUAGE 'c' IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION _ST_Touches(geom1 geometry, geom2 geometry)
- RETURNS boolean
- AS '$libdir/postgis-2.0','touches'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS boolean
+ AS '$libdir/postgis-2.0','touches'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_Touches(geom1 geometry, geom2 geometry)
- RETURNS boolean
- AS 'SELECT $1 && $2 AND _ST_Touches($1,$2)'
- LANGUAGE 'sql' IMMUTABLE;
+ RETURNS boolean
+ AS 'SELECT $1 && $2 AND _ST_Touches($1,$2)'
+ LANGUAGE 'sql' IMMUTABLE;
CREATE OR REPLACE FUNCTION _ST_DWithin(geom1 geometry, geom2 geometry,float8)
- RETURNS boolean
- AS '$libdir/postgis-2.0', 'LWGEOM_dwithin'
- LANGUAGE 'c' IMMUTABLE STRICT
- COST 100;
+ RETURNS boolean
+ AS '$libdir/postgis-2.0', 'LWGEOM_dwithin'
+ LANGUAGE 'c' IMMUTABLE STRICT
+ COST 100;
CREATE OR REPLACE FUNCTION ST_DWithin(geom1 geometry, geom2 geometry, float8)
- RETURNS boolean
- AS 'SELECT $1 && ST_Expand($2,$3) AND $2 && ST_Expand($1,$3) AND _ST_DWithin($1, $2, $3)'
- LANGUAGE 'sql' IMMUTABLE;
+ RETURNS boolean