pgLatLon

changeset 73:b5bc6b35b716

Allow non-superusers to install extension; Properly support loading extension into schema; Do not allow schema relocation
author jbe
date Sun Nov 29 19:55:33 2020 +0100 (2020-11-29)
parents 8fa0ef5e4ee6
children 76b3fd3293fc
files latlon--0.14--0.15.sql latlon--0.15.sql latlon.control
line diff
     1.1 --- a/latlon--0.14--0.15.sql	Wed Feb 12 13:11:04 2020 +0100
     1.2 +++ b/latlon--0.14--0.15.sql	Sun Nov 29 19:55:33 2020 +0100
     1.3 @@ -1,3 +1,5 @@
     1.4 +SET LOCAL search_path TO @extschema@;
     1.5 +
     1.6  
     1.7  ------------------------------------------------------------
     1.8  -- dummy input/output functions for dummy index key types --
     1.9 @@ -275,6 +277,18 @@
    1.10    LANGUAGE C IMMUTABLE STRICT
    1.11    AS '$libdir/latlon-v0010', 'pgl_create_epoint';
    1.12  
    1.13 +CREATE OR REPLACE FUNCTION epoint_latlon(float8, float8)
    1.14 +  RETURNS epoint
    1.15 +  LANGUAGE SQL IMMUTABLE STRICT AS $$
    1.16 +    SELECT @extschema@.epoint($1, $2)
    1.17 +  $$;
    1.18 +
    1.19 +CREATE OR REPLACE FUNCTION epoint_lonlat(float8, float8)
    1.20 +  RETURNS epoint
    1.21 +  LANGUAGE SQL IMMUTABLE STRICT AS $$
    1.22 +    SELECT @extschema@.epoint($2, $1)
    1.23 +  $$;
    1.24 +
    1.25  CREATE OR REPLACE FUNCTION epoint_with_sample_count(epoint, int4)
    1.26    RETURNS epoint_with_sample_count
    1.27    LANGUAGE C IMMUTABLE STRICT
    1.28 @@ -305,6 +319,74 @@
    1.29    LANGUAGE C IMMUTABLE STRICT
    1.30    AS '$libdir/latlon-v0010', 'pgl_create_ecircle_from_epoint';
    1.31  
    1.32 +CREATE OR REPLACE FUNCTION ecluster_concat(ecluster[])
    1.33 +  RETURNS ecluster
    1.34 +  LANGUAGE sql IMMUTABLE STRICT AS $$
    1.35 +    SELECT pg_catalog.array_to_string($1, ' ')::@extschema@.ecluster
    1.36 +  $$;
    1.37 +
    1.38 +CREATE OR REPLACE FUNCTION ecluster_concat(ecluster, ecluster)
    1.39 +  RETURNS ecluster
    1.40 +  LANGUAGE sql IMMUTABLE STRICT AS $$
    1.41 +    SELECT (
    1.42 +      $1::pg_catalog.text OPERATOR(pg_catalog.||) ' ' OPERATOR(pg_catalog.||)
    1.43 +      $2::pg_catalog.text
    1.44 +    )::@extschema@.ecluster
    1.45 +  $$;
    1.46 +
    1.47 +CREATE OR REPLACE FUNCTION ecluster_create_multipoint(epoint[])
    1.48 +  RETURNS ecluster
    1.49 +  LANGUAGE sql IMMUTABLE STRICT AS $$
    1.50 +    SELECT
    1.51 +      pg_catalog.array_to_string(
    1.52 +        pg_catalog.array_agg(
    1.53 +          'point (' OPERATOR(pg_catalog.||) unnest OPERATOR(pg_catalog.||) ')'
    1.54 +        ),
    1.55 +        ' '
    1.56 +      )::@extschema@.ecluster
    1.57 +    FROM pg_catalog.unnest($1)
    1.58 +  $$;
    1.59 +
    1.60 +CREATE OR REPLACE FUNCTION ecluster_create_path(epoint[])
    1.61 +  RETURNS ecluster
    1.62 +  LANGUAGE sql IMMUTABLE STRICT AS $$
    1.63 +    SELECT CASE WHEN "str" OPERATOR(pg_catalog.=) '' THEN
    1.64 +      'empty'::@extschema@.ecluster
    1.65 +    ELSE
    1.66 +      (
    1.67 +        'path (' OPERATOR(pg_catalog.||) "str" OPERATOR(pg_catalog.||) ')'
    1.68 +      )::@extschema@.ecluster
    1.69 +    END
    1.70 +    FROM pg_catalog.array_to_string($1, ' ') AS "str"
    1.71 +  $$;
    1.72 +
    1.73 +CREATE OR REPLACE FUNCTION ecluster_create_outline(epoint[])
    1.74 +  RETURNS ecluster
    1.75 +  LANGUAGE sql IMMUTABLE STRICT AS $$
    1.76 +    SELECT CASE WHEN "str" OPERATOR(pg_catalog.=) '' THEN
    1.77 +      'empty'::@extschema@.ecluster
    1.78 +    ELSE
    1.79 +      (
    1.80 +        'outline (' OPERATOR(pg_catalog.||) "str" OPERATOR(pg_catalog.||) ')'
    1.81 +      )::@extschema@.ecluster
    1.82 +    END
    1.83 +    FROM pg_catalog.array_to_string($1, ' ') AS "str"
    1.84 +  $$;
    1.85 +
    1.86 +CREATE OR REPLACE FUNCTION ecluster_create_polygon(epoint[])
    1.87 +  RETURNS ecluster
    1.88 +  LANGUAGE sql IMMUTABLE STRICT AS $$
    1.89 +    SELECT CASE WHEN "str" OPERATOR(pg_catalog.=) '' THEN
    1.90 +      'empty'::@extschema@.ecluster
    1.91 +    ELSE
    1.92 +      (
    1.93 +        'polygon (' OPERATOR(pg_catalog.||) pg_catalog.array_to_string($1, ' ')
    1.94 +        OPERATOR(pg_catalog.||) ')'
    1.95 +      )::@extschema@.ecluster
    1.96 +    END
    1.97 +    FROM pg_catalog.array_to_string($1, ' ') AS "str"
    1.98 +  $$;
    1.99 +
   1.100  
   1.101  ----------------------
   1.102  -- getter functions --
   1.103 @@ -350,6 +432,51 @@
   1.104    LANGUAGE C IMMUTABLE STRICT
   1.105    AS '$libdir/latlon-v0010', 'pgl_ecircle_radius';
   1.106  
   1.107 +CREATE OR REPLACE FUNCTION ecluster_extract_points(ecluster)
   1.108 +  RETURNS SETOF epoint
   1.109 +  LANGUAGE sql IMMUTABLE STRICT AS $$
   1.110 +    SELECT "match"[2]::@extschema@.epoint
   1.111 +    FROM pg_catalog.regexp_matches(
   1.112 +      $1::pg_catalog.text, e'(^| )point \\(([^)]+)\\)', 'g'
   1.113 +    ) AS "match"
   1.114 +  $$;
   1.115 +
   1.116 +CREATE OR REPLACE FUNCTION ecluster_extract_paths(ecluster)
   1.117 +  RETURNS SETOF epoint[]
   1.118 +  LANGUAGE sql IMMUTABLE STRICT AS $$
   1.119 +    SELECT (
   1.120 +      SELECT pg_catalog.array_agg("m2"[1]::@extschema@.epoint)
   1.121 +      FROM pg_catalog.regexp_matches("m1"[2], e'[^ ]+ [^ ]+', 'g') AS "m2"
   1.122 +    )
   1.123 +    FROM pg_catalog.regexp_matches(
   1.124 +      $1::pg_catalog.text, e'(^| )path \\(([^)]+)\\)', 'g'
   1.125 +    ) AS "m1"
   1.126 +  $$;
   1.127 +
   1.128 +CREATE OR REPLACE FUNCTION ecluster_extract_outlines(ecluster)
   1.129 +  RETURNS SETOF epoint[]
   1.130 +  LANGUAGE sql IMMUTABLE STRICT AS $$
   1.131 +    SELECT (
   1.132 +      SELECT pg_catalog.array_agg("m2"[1]::@extschema@.epoint)
   1.133 +      FROM pg_catalog.regexp_matches("m1"[2], e'[^ ]+ [^ ]+', 'g') AS "m2"
   1.134 +    )
   1.135 +    FROM pg_catalog.regexp_matches(
   1.136 +      $1::pg_catalog.text, e'(^| )outline \\(([^)]+)\\)', 'g'
   1.137 +    ) AS "m1"
   1.138 +  $$;
   1.139 +
   1.140 +CREATE OR REPLACE FUNCTION ecluster_extract_polygons(ecluster)
   1.141 +  RETURNS SETOF epoint[]
   1.142 +  LANGUAGE sql IMMUTABLE STRICT AS $$
   1.143 +    SELECT (
   1.144 +      SELECT pg_catalog.array_agg("m2"[1]::@extschema@.epoint)
   1.145 +      FROM pg_catalog.regexp_matches("m1"[2], e'[^ ]+ [^ ]+', 'g') AS "m2"
   1.146 +    )
   1.147 +    FROM pg_catalog.regexp_matches(
   1.148 +      $1::pg_catalog.text, e'(^| )polygon \\(([^)]+)\\)', 'g'
   1.149 +    ) AS "m1"
   1.150 +  $$;
   1.151 +
   1.152  
   1.153  ---------------
   1.154  -- operators --
   1.155 @@ -455,6 +582,145 @@
   1.156    LANGUAGE C IMMUTABLE STRICT
   1.157    AS '$libdir/latlon-v0010', 'pgl_ecluster_epoint_sc_fair_distance';
   1.158  
   1.159 +CREATE OR REPLACE FUNCTION epoint_ebox_overlap_commutator(ebox, epoint)
   1.160 +  RETURNS boolean
   1.161 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&) $1';
   1.162 +
   1.163 +CREATE OR REPLACE FUNCTION epoint_ecircle_overlap_commutator(ecircle, epoint)
   1.164 +  RETURNS boolean
   1.165 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&) $1';
   1.166 +
   1.167 +CREATE OR REPLACE FUNCTION epoint_ecluster_overlap_commutator(ecluster, epoint)
   1.168 +  RETURNS boolean
   1.169 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&) $1';
   1.170 +
   1.171 +CREATE OR REPLACE FUNCTION ecircle_ecluster_overlap_commutator(ecluster, ecircle)
   1.172 +  RETURNS boolean
   1.173 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&) $1';
   1.174 +
   1.175 +CREATE OR REPLACE FUNCTION ebox_ecircle_overlap_castwrap(ebox, ecircle)
   1.176 +  RETURNS boolean
   1.177 +  LANGUAGE sql IMMUTABLE
   1.178 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.&&) $2';
   1.179 +
   1.180 +CREATE OR REPLACE FUNCTION ebox_ecircle_overlap_castwrap(ecircle, ebox)
   1.181 +  RETURNS boolean
   1.182 +  LANGUAGE sql IMMUTABLE
   1.183 +  AS 'SELECT $1 OPERATOR(@extschema@.&&) $2::@extschema@.ecluster';
   1.184 +
   1.185 +CREATE OR REPLACE FUNCTION ebox_ecluster_overlap_castwrap(ebox, ecluster)
   1.186 +  RETURNS boolean
   1.187 +  LANGUAGE sql IMMUTABLE
   1.188 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.&&) $2';
   1.189 +
   1.190 +CREATE OR REPLACE FUNCTION ebox_ecluster_overlap_castwrap(ecluster, ebox)
   1.191 +  RETURNS boolean
   1.192 +  LANGUAGE sql IMMUTABLE
   1.193 +  AS 'SELECT $1 OPERATOR(@extschema@.&&) $2::@extschema@.ecluster';
   1.194 +
   1.195 +CREATE OR REPLACE FUNCTION epoint_ecluster_may_overlap_commutator(ecluster, epoint)
   1.196 +  RETURNS boolean
   1.197 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&+) $1';
   1.198 +
   1.199 +CREATE OR REPLACE FUNCTION ebox_ecircle_may_overlap_commutator(ecircle, ebox)
   1.200 +  RETURNS boolean
   1.201 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&+) $1';
   1.202 +
   1.203 +CREATE OR REPLACE FUNCTION ebox_ecluster_may_overlap_commutator(ecluster, ebox)
   1.204 +  RETURNS boolean
   1.205 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&+) $1';
   1.206 +
   1.207 +CREATE OR REPLACE FUNCTION ecircle_ecluster_may_overlap_commutator(ecluster, ecircle)
   1.208 +  RETURNS boolean
   1.209 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&+) $1';
   1.210 +
   1.211 +CREATE OR REPLACE FUNCTION ecluster_contains_commutator(ecluster, ecluster)
   1.212 +  RETURNS boolean
   1.213 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.@>) $1';
   1.214 +
   1.215 +CREATE OR REPLACE FUNCTION ebox_contains_castwrap(ebox, ebox)
   1.216 +  RETURNS boolean
   1.217 +  LANGUAGE sql IMMUTABLE AS $$
   1.218 +    SELECT
   1.219 +    $1::@extschema@.ecluster OPERATOR(@extschema@.@>) $2::@extschema@.ecluster
   1.220 +  $$;
   1.221 +
   1.222 +CREATE OR REPLACE FUNCTION ebox_contains_swapped_castwrap(ebox, ebox)
   1.223 +  RETURNS boolean
   1.224 +  LANGUAGE sql IMMUTABLE AS $$
   1.225 +    SELECT
   1.226 +    $2::@extschema@.ecluster OPERATOR(@extschema@.@>) $1::@extschema@.ecluster
   1.227 +  $$;
   1.228 +
   1.229 +CREATE OR REPLACE FUNCTION ebox_ecluster_contains_castwrap(ebox, ecluster)
   1.230 +  RETURNS boolean
   1.231 +  LANGUAGE sql IMMUTABLE
   1.232 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.@>) $2';
   1.233 +
   1.234 +CREATE OR REPLACE FUNCTION ebox_ecluster_contains_castwrap(ecluster, ebox)
   1.235 +  RETURNS boolean
   1.236 +  LANGUAGE sql IMMUTABLE
   1.237 +  AS 'SELECT $2::@extschema@.ecluster OPERATOR(@extschema@.@>) $1';
   1.238 +
   1.239 +CREATE OR REPLACE FUNCTION ecluster_ebox_contains_castwrap(ecluster, ebox)
   1.240 +  RETURNS boolean
   1.241 +  LANGUAGE sql IMMUTABLE
   1.242 +  AS 'SELECT $1 OPERATOR(@extschema@.@>) $2::@extschema@.ecluster';
   1.243 +
   1.244 +CREATE OR REPLACE FUNCTION ecluster_ebox_contains_castwrap(ebox, ecluster)
   1.245 +  RETURNS boolean
   1.246 +  LANGUAGE sql IMMUTABLE
   1.247 +  AS 'SELECT $2 OPERATOR(@extschema@.@>) $1::@extschema@.ecluster';
   1.248 +
   1.249 +CREATE OR REPLACE FUNCTION epoint_ecircle_distance_commutator(ecircle, epoint)
   1.250 +  RETURNS float8
   1.251 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.<->) $1';
   1.252 +
   1.253 +CREATE OR REPLACE FUNCTION epoint_ecluster_distance_commutator(ecluster, epoint)
   1.254 +  RETURNS float8
   1.255 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.<->) $1';
   1.256 +
   1.257 +CREATE OR REPLACE FUNCTION ecircle_ecluster_distance_commutator(ecluster, ecircle)
   1.258 +  RETURNS float8
   1.259 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.<->) $1';
   1.260 +
   1.261 +CREATE OR REPLACE FUNCTION epoint_ebox_distance_castwrap(epoint, ebox)
   1.262 +  RETURNS float8
   1.263 +  LANGUAGE sql IMMUTABLE
   1.264 +  AS 'SELECT $1 OPERATOR(@extschema@.<->) $2::@extschema@.ecluster';
   1.265 +
   1.266 +CREATE OR REPLACE FUNCTION epoint_ebox_distance_castwrap(ebox, epoint)
   1.267 +  RETURNS float8
   1.268 +  LANGUAGE sql IMMUTABLE
   1.269 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.<->) $2';
   1.270 +
   1.271 +CREATE OR REPLACE FUNCTION ebox_distance_castwrap(ebox, ebox)
   1.272 +  RETURNS float8
   1.273 +  LANGUAGE sql IMMUTABLE AS $$
   1.274 +    SELECT
   1.275 +    $1::@extschema@.ecluster OPERATOR(@extschema@.<->) $2::@extschema@.ecluster
   1.276 +  $$;
   1.277 +
   1.278 +CREATE OR REPLACE FUNCTION ebox_ecircle_distance_castwrap(ebox, ecircle)
   1.279 +  RETURNS float8
   1.280 +  LANGUAGE sql IMMUTABLE
   1.281 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.<->) $2';
   1.282 +
   1.283 +CREATE OR REPLACE FUNCTION ebox_ecircle_distance_castwrap(ecircle, ebox)
   1.284 +  RETURNS float8
   1.285 +  LANGUAGE sql IMMUTABLE
   1.286 +  AS 'SELECT $1 OPERATOR(@extschema@.<->) $2::@extschema@.ecluster';
   1.287 +
   1.288 +CREATE OR REPLACE FUNCTION ebox_ecluster_distance_castwrap(ebox, ecluster)
   1.289 +  RETURNS float8
   1.290 +  LANGUAGE sql IMMUTABLE
   1.291 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.<->) $2';
   1.292 +
   1.293 +CREATE OR REPLACE FUNCTION ebox_ecluster_distance_castwrap(ecluster, ebox)
   1.294 +  RETURNS float8
   1.295 +  LANGUAGE sql IMMUTABLE
   1.296 +  AS 'SELECT $1 OPERATOR(@extschema@.<->) $2::@extschema@.ecluster';
   1.297 +
   1.298  
   1.299  ----------------
   1.300  -- GiST index --
   1.301 @@ -510,3 +776,225 @@
   1.302    LANGUAGE C STRICT
   1.303    AS '$libdir/latlon-v0010', 'pgl_gist_distance';
   1.304  
   1.305 +
   1.306 +---------------------
   1.307 +-- alias functions --
   1.308 +---------------------
   1.309 +
   1.310 +CREATE OR REPLACE FUNCTION distance(epoint, epoint)
   1.311 +  RETURNS float8
   1.312 +  LANGUAGE sql IMMUTABLE AS 'SELECT $1 OPERATOR(@extschema@.<->) $2';
   1.313 +
   1.314 +CREATE OR REPLACE FUNCTION distance(ecluster, epoint)
   1.315 +  RETURNS float8
   1.316 +  LANGUAGE sql IMMUTABLE AS 'SELECT $1 OPERATOR(@extschema@.<->) $2';
   1.317 +
   1.318 +CREATE OR REPLACE FUNCTION distance_within(epoint, epoint, float8)
   1.319 +  RETURNS boolean
   1.320 +  LANGUAGE sql IMMUTABLE
   1.321 +  AS 'SELECT $1 OPERATOR(@extschema@.&&) @extschema@.ecircle($2, $3)';
   1.322 +
   1.323 +CREATE OR REPLACE FUNCTION distance_within(ecluster, epoint, float8)
   1.324 +  RETURNS boolean
   1.325 +  LANGUAGE sql IMMUTABLE
   1.326 +  AS 'SELECT $1 OPERATOR(@extschema@.&&) @extschema@.ecircle($2, $3)';
   1.327 +
   1.328 +CREATE OR REPLACE FUNCTION fair_distance(ecluster, epoint, int4 = 10000)
   1.329 +  RETURNS float8
   1.330 +  LANGUAGE sql IMMUTABLE AS $$
   1.331 +    SELECT
   1.332 +    $1 OPERATOR(@extschema@.<=>) @extschema@.epoint_with_sample_count($2, $3)
   1.333 +  $$;
   1.334 +
   1.335 +
   1.336 +--------------------------------
   1.337 +-- other data storage formats --
   1.338 +--------------------------------
   1.339 +
   1.340 +CREATE OR REPLACE FUNCTION coords_to_epoint(float8, float8, text = 'epoint')
   1.341 +  RETURNS epoint
   1.342 +  LANGUAGE plpgsql IMMUTABLE STRICT AS $$
   1.343 +    DECLARE
   1.344 +      "result" @extschema@.epoint;
   1.345 +    BEGIN
   1.346 +      IF $3 OPERATOR(pg_catalog.=) 'epoint_lonlat' THEN
   1.347 +        -- avoid dynamic command execution for better performance
   1.348 +        RETURN @extschema@.epoint($2, $1);
   1.349 +      END IF;
   1.350 +      IF
   1.351 +        $3 OPERATOR(pg_catalog.=) 'epoint' OR
   1.352 +        $3 OPERATOR(pg_catalog.=) 'epoint_latlon'
   1.353 +      THEN
   1.354 +        -- avoid dynamic command execution for better performance
   1.355 +        RETURN @extschema@.epoint($1, $2);
   1.356 +      END IF;
   1.357 +      EXECUTE
   1.358 +        'SELECT ' OPERATOR(pg_catalog.||) $3 OPERATOR(pg_catalog.||) '($1, $2)'         INTO STRICT "result" USING $1, $2;
   1.359 +      RETURN "result";
   1.360 +    END;
   1.361 +  $$;
   1.362 +
   1.363 +CREATE OR REPLACE FUNCTION GeoJSON_LinearRing_vertices(jsonb, text = 'epoint_lonlat')
   1.364 +  RETURNS SETOF jsonb
   1.365 +  LANGUAGE sql IMMUTABLE STRICT AS $$
   1.366 +    SELECT "result" FROM
   1.367 +      ( SELECT pg_catalog.jsonb_array_length($1) - 1 )
   1.368 +      AS "lastindex_row" ("lastindex")
   1.369 +      CROSS JOIN LATERAL pg_catalog.jsonb_array_elements(
   1.370 +        CASE WHEN
   1.371 +          @extschema@.coords_to_epoint(
   1.372 +            ($1 OPERATOR(pg_catalog.->) 0 OPERATOR(pg_catalog.->>) 0)
   1.373 +            ::pg_catalog.float8,
   1.374 +            ($1 OPERATOR(pg_catalog.->) 0 OPERATOR(pg_catalog.->>) 1)
   1.375 +            ::pg_catalog.float8,
   1.376 +            $2
   1.377 +          ) OPERATOR(pg_catalog.=) @extschema@.coords_to_epoint(
   1.378 +            ($1 OPERATOR(pg_catalog.->) "lastindex" OPERATOR(pg_catalog.->>) 0)
   1.379 +            ::pg_catalog.float8,
   1.380 +            ($1 OPERATOR(pg_catalog.->) "lastindex" OPERATOR(pg_catalog.->>) 1)
   1.381 +            ::pg_catalog.float8,
   1.382 +            $2
   1.383 +          )
   1.384 +        THEN
   1.385 +          $1 - "lastindex"
   1.386 +        ELSE
   1.387 +          $1
   1.388 +        END
   1.389 +      ) AS "result_row" ("result")
   1.390 +  $$;
   1.391 +
   1.392 +CREATE OR REPLACE FUNCTION GeoJSON_to_epoint(jsonb, text = 'epoint_lonlat')
   1.393 +  RETURNS epoint
   1.394 +  LANGUAGE sql IMMUTABLE STRICT AS $$
   1.395 +    SELECT CASE
   1.396 +    WHEN $1 OPERATOR(pg_catalog.->>) 'type' OPERATOR(pg_catalog.=) 'Point' THEN
   1.397 +      @extschema@.coords_to_epoint(
   1.398 +        ($1 OPERATOR(pg_catalog.->) 'coordinates' OPERATOR(pg_catalog.->>) 0)
   1.399 +        ::pg_catalog.float8,
   1.400 +        ($1 OPERATOR(pg_catalog.->) 'coordinates' OPERATOR(pg_catalog.->>) 1)
   1.401 +        ::pg_catalog.float8,
   1.402 +        $2
   1.403 +      )
   1.404 +    WHEN $1->>'type' = 'Feature' THEN
   1.405 +      @extschema@.GeoJSON_to_epoint($1 OPERATOR(pg_catalog.->) 'geometry', $2)
   1.406 +    ELSE
   1.407 +      NULL
   1.408 +    END
   1.409 +  $$;
   1.410 +
   1.411 +CREATE OR REPLACE FUNCTION GeoJSON_to_ecluster(jsonb, text = 'epoint_lonlat')
   1.412 +  RETURNS ecluster
   1.413 +  LANGUAGE sql IMMUTABLE STRICT AS $$
   1.414 +    SELECT CASE $1 OPERATOR(pg_catalog.->>) 'type'
   1.415 +    WHEN 'Point' THEN
   1.416 +      @extschema@.coords_to_epoint(
   1.417 +        ($1 OPERATOR(pg_catalog.->) 'coordinates' OPERATOR(pg_catalog.->>) 0)
   1.418 +        ::pg_catalog.float8,
   1.419 +        ($1 OPERATOR(pg_catalog.->) 'coordinates' OPERATOR(pg_catalog.->>) 1)
   1.420 +        ::pg_catalog.float8,
   1.421 +        $2
   1.422 +      )::@extschema@.ecluster
   1.423 +    WHEN 'MultiPoint' THEN
   1.424 +      ( SELECT @extschema@.ecluster_create_multipoint(pg_catalog.array_agg(
   1.425 +          @extschema@.coords_to_epoint(
   1.426 +            ("coord" OPERATOR(pg_catalog.->>) 0)::pg_catalog.float8,
   1.427 +            ("coord" OPERATOR(pg_catalog.->>) 1)::pg_catalog.float8,
   1.428 +            $2
   1.429 +          )
   1.430 +        ))
   1.431 +        FROM pg_catalog.jsonb_array_elements(
   1.432 +          $1 OPERATOR(pg_catalog.->) 'coordinates'
   1.433 +        ) AS "coord"
   1.434 +      )
   1.435 +    WHEN 'LineString' THEN
   1.436 +      ( SELECT @extschema@.ecluster_create_path(pg_catalog.array_agg(
   1.437 +          @extschema@.coords_to_epoint(
   1.438 +            ("coord" OPERATOR(pg_catalog.->>) 0)::pg_catalog.float8,
   1.439 +            ("coord" OPERATOR(pg_catalog.->>) 1)::pg_catalog.float8,
   1.440 +            $2
   1.441 +          )
   1.442 +        ))
   1.443 +        FROM pg_catalog.jsonb_array_elements(
   1.444 +          $1 OPERATOR(pg_catalog.->) 'coordinates'
   1.445 +        ) AS "coord"
   1.446 +      )
   1.447 +    WHEN 'MultiLineString' THEN
   1.448 +      ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   1.449 +          ( SELECT @extschema@.ecluster_create_path(pg_catalog.array_agg(
   1.450 +              coords_to_epoint(
   1.451 +                ("coord" OPERATOR(pg_catalog.->>) 0)::pg_catalog.float8,
   1.452 +                ("coord" OPERATOR(pg_catalog.->>) 1)::pg_catalog.float8,
   1.453 +                $2
   1.454 +              )
   1.455 +            ))
   1.456 +            FROM pg_catalog.jsonb_array_elements("coord_array") AS "coord"
   1.457 +          )
   1.458 +        ))
   1.459 +        FROM pg_catalog.jsonb_array_elements(
   1.460 +          $1 OPERATOR(pg_catalog.->) 'coordinates'
   1.461 +        ) AS "coord_array"
   1.462 +      )
   1.463 +    WHEN 'Polygon' THEN
   1.464 +      ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   1.465 +          ( SELECT @extschema@.ecluster_create_polygon(pg_catalog.array_agg(
   1.466 +              @extschema@.coords_to_epoint(
   1.467 +                ("coord" OPERATOR(pg_catalog.->>) 0)::pg_catalog.float8,
   1.468 +                ("coord" OPERATOR(pg_catalog.->>) 1)::pg_catalog.float8,
   1.469 +                $2
   1.470 +              )
   1.471 +            ))
   1.472 +            FROM @extschema@.GeoJSON_LinearRing_vertices("coord_array", $2)
   1.473 +            AS "coord"
   1.474 +          )
   1.475 +        ))
   1.476 +        FROM pg_catalog.jsonb_array_elements(
   1.477 +          $1 OPERATOR(pg_catalog.->) 'coordinates'
   1.478 +        ) AS "coord_array"
   1.479 +      )
   1.480 +    WHEN 'MultiPolygon' THEN
   1.481 +      ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   1.482 +          ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   1.483 +              ( SELECT pg_catalog.ecluster_create_polygon(pg_catalog.array_agg(
   1.484 +                  @extschema@.coords_to_epoint(
   1.485 +                    ("coord" OPERATOR(pg_catalog.->>) 0)::pg_catalog.float8,
   1.486 +                    ("coord" OPERATOR(pg_catalog.->>) 1)::pg_catalog.float8,
   1.487 +                    $2
   1.488 +                  )
   1.489 +                ))
   1.490 +                FROM @extschema@.GeoJSON_LinearRing_vertices("coord_array", $2)
   1.491 +                AS "coord"
   1.492 +              )
   1.493 +            ))
   1.494 +            FROM pg_catalog.jsonb_array_elements("coord_array_array")
   1.495 +            AS "coord_array"
   1.496 +          )
   1.497 +        ))
   1.498 +        FROM jsonb_array_elements(
   1.499 +          $1 OPERATOR(pg_catalog.->) 'coordinates'
   1.500 +        ) AS "coord_array_array"
   1.501 +      )
   1.502 +    WHEN 'GeometryCollection' THEN
   1.503 +      ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   1.504 +          @extschema@.GeoJSON_to_ecluster("geometry", $2)
   1.505 +        ))
   1.506 +        FROM pg_catalog.jsonb_array_elements(
   1.507 +          $1 OPERATOR(pg_catalog.->) 'geometries'
   1.508 +        ) AS "geometry"
   1.509 +      )
   1.510 +    WHEN 'Feature' THEN
   1.511 +      @extschema@.GeoJSON_to_ecluster(
   1.512 +        $1 OPERATOR(pg_catalog.->) 'geometry', $2
   1.513 +      )
   1.514 +    WHEN 'FeatureCollection' THEN
   1.515 +      ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   1.516 +          @extschema@.GeoJSON_to_ecluster("feature", $2)
   1.517 +        ))
   1.518 +        FROM pg_catalog.jsonb_array_elements(
   1.519 +          $1 OPERATOR(pg_catalog.->) 'features'
   1.520 +        ) AS "feature"
   1.521 +      )
   1.522 +    ELSE
   1.523 +      NULL
   1.524 +    END
   1.525 +  $$;
   1.526 +
     2.1 --- a/latlon--0.15.sql	Wed Feb 12 13:11:04 2020 +0100
     2.2 +++ b/latlon--0.15.sql	Sun Nov 29 19:55:33 2020 +0100
     2.3 @@ -1,3 +1,5 @@
     2.4 +SET LOCAL search_path TO @extschema@;
     2.5 +
     2.6  
     2.7  ----------------------------------------
     2.8  -- forward declarations (shell types) --
     2.9 @@ -568,13 +570,13 @@
    2.10  CREATE FUNCTION epoint_latlon(float8, float8)
    2.11    RETURNS epoint
    2.12    LANGUAGE SQL IMMUTABLE STRICT AS $$
    2.13 -    SELECT epoint($1, $2)
    2.14 +    SELECT @extschema@.epoint($1, $2)
    2.15    $$;
    2.16  
    2.17  CREATE FUNCTION epoint_lonlat(float8, float8)
    2.18    RETURNS epoint
    2.19    LANGUAGE SQL IMMUTABLE STRICT AS $$
    2.20 -    SELECT epoint($2, $1)
    2.21 +    SELECT @extschema@.epoint($2, $1)
    2.22    $$;
    2.23  
    2.24  CREATE FUNCTION epoint_with_sample_count(epoint, int4)
    2.25 @@ -610,48 +612,69 @@
    2.26  CREATE FUNCTION ecluster_concat(ecluster[])
    2.27    RETURNS ecluster
    2.28    LANGUAGE sql IMMUTABLE STRICT AS $$
    2.29 -    SELECT array_to_string($1, ' ')::ecluster
    2.30 +    SELECT pg_catalog.array_to_string($1, ' ')::@extschema@.ecluster
    2.31    $$;
    2.32  
    2.33  CREATE FUNCTION ecluster_concat(ecluster, ecluster)
    2.34    RETURNS ecluster
    2.35    LANGUAGE sql IMMUTABLE STRICT AS $$
    2.36 -    SELECT ($1::text || ' ' || $2::text)::ecluster
    2.37 +    SELECT (
    2.38 +      $1::pg_catalog.text OPERATOR(pg_catalog.||) ' ' OPERATOR(pg_catalog.||)
    2.39 +      $2::pg_catalog.text
    2.40 +    )::@extschema@.ecluster
    2.41    $$;
    2.42  
    2.43  CREATE FUNCTION ecluster_create_multipoint(epoint[])
    2.44    RETURNS ecluster
    2.45    LANGUAGE sql IMMUTABLE STRICT AS $$
    2.46      SELECT
    2.47 -      array_to_string(array_agg('point (' || unnest || ')'), ' ')::ecluster
    2.48 -    FROM unnest($1)
    2.49 +      pg_catalog.array_to_string(
    2.50 +        pg_catalog.array_agg(
    2.51 +          'point (' OPERATOR(pg_catalog.||) unnest OPERATOR(pg_catalog.||) ')'
    2.52 +        ),
    2.53 +        ' '
    2.54 +      )::@extschema@.ecluster
    2.55 +    FROM pg_catalog.unnest($1)
    2.56    $$;
    2.57  
    2.58  CREATE FUNCTION ecluster_create_path(epoint[])
    2.59    RETURNS ecluster
    2.60    LANGUAGE sql IMMUTABLE STRICT AS $$
    2.61 -    SELECT CASE WHEN "str" = '' THEN 'empty'::ecluster ELSE
    2.62 -      ('path (' || array_to_string($1, ' ') || ')')::ecluster
    2.63 +    SELECT CASE WHEN "str" OPERATOR(pg_catalog.=) '' THEN
    2.64 +      'empty'::@extschema@.ecluster
    2.65 +    ELSE
    2.66 +      (
    2.67 +        'path (' OPERATOR(pg_catalog.||) "str" OPERATOR(pg_catalog.||) ')'
    2.68 +      )::@extschema@.ecluster
    2.69      END
    2.70 -    FROM array_to_string($1, ' ') AS "str"
    2.71 +    FROM pg_catalog.array_to_string($1, ' ') AS "str"
    2.72    $$;
    2.73  
    2.74  CREATE FUNCTION ecluster_create_outline(epoint[])
    2.75    RETURNS ecluster
    2.76    LANGUAGE sql IMMUTABLE STRICT AS $$
    2.77 -    SELECT CASE WHEN "str" = '' THEN 'empty'::ecluster ELSE
    2.78 -      ('outline (' || array_to_string($1, ' ') || ')')::ecluster
    2.79 +    SELECT CASE WHEN "str" OPERATOR(pg_catalog.=) '' THEN
    2.80 +      'empty'::@extschema@.ecluster
    2.81 +    ELSE
    2.82 +      (
    2.83 +        'outline (' OPERATOR(pg_catalog.||) "str" OPERATOR(pg_catalog.||) ')'
    2.84 +      )::@extschema@.ecluster
    2.85      END
    2.86 -    FROM array_to_string($1, ' ') AS "str"
    2.87 +    FROM pg_catalog.array_to_string($1, ' ') AS "str"
    2.88    $$;
    2.89  
    2.90  CREATE FUNCTION ecluster_create_polygon(epoint[])
    2.91    RETURNS ecluster
    2.92    LANGUAGE sql IMMUTABLE STRICT AS $$
    2.93 -    SELECT CASE WHEN "str" = '' THEN 'empty'::ecluster ELSE
    2.94 -      ('polygon (' || array_to_string($1, ' ') || ')')::ecluster
    2.95 +    SELECT CASE WHEN "str" OPERATOR(pg_catalog.=) '' THEN
    2.96 +      'empty'::@extschema@.ecluster
    2.97 +    ELSE
    2.98 +      (
    2.99 +        'polygon (' OPERATOR(pg_catalog.||) pg_catalog.array_to_string($1, ' ')
   2.100 +        OPERATOR(pg_catalog.||) ')'
   2.101 +      )::@extschema@.ecluster
   2.102      END
   2.103 -    FROM array_to_string($1, ' ') AS "str"
   2.104 +    FROM pg_catalog.array_to_string($1, ' ') AS "str"
   2.105    $$;
   2.106  
   2.107  
   2.108 @@ -702,38 +725,46 @@
   2.109  CREATE FUNCTION ecluster_extract_points(ecluster)
   2.110    RETURNS SETOF epoint
   2.111    LANGUAGE sql IMMUTABLE STRICT AS $$
   2.112 -    SELECT "match"[2]::epoint
   2.113 -    FROM regexp_matches($1::text, e'(^| )point \\(([^)]+)\\)', 'g') AS "match"
   2.114 +    SELECT "match"[2]::@extschema@.epoint
   2.115 +    FROM pg_catalog.regexp_matches(
   2.116 +      $1::pg_catalog.text, e'(^| )point \\(([^)]+)\\)', 'g'
   2.117 +    ) AS "match"
   2.118    $$;
   2.119  
   2.120  CREATE FUNCTION ecluster_extract_paths(ecluster)
   2.121    RETURNS SETOF epoint[]
   2.122    LANGUAGE sql IMMUTABLE STRICT AS $$
   2.123      SELECT (
   2.124 -      SELECT array_agg("m2"[1]::epoint)
   2.125 -      FROM regexp_matches("m1"[2], e'[^ ]+ [^ ]+', 'g') AS "m2"
   2.126 +      SELECT pg_catalog.array_agg("m2"[1]::@extschema@.epoint)
   2.127 +      FROM pg_catalog.regexp_matches("m1"[2], e'[^ ]+ [^ ]+', 'g') AS "m2"
   2.128      )
   2.129 -    FROM regexp_matches($1::text, e'(^| )path \\(([^)]+)\\)', 'g') AS "m1"
   2.130 +    FROM pg_catalog.regexp_matches(
   2.131 +      $1::pg_catalog.text, e'(^| )path \\(([^)]+)\\)', 'g'
   2.132 +    ) AS "m1"
   2.133    $$;
   2.134  
   2.135  CREATE FUNCTION ecluster_extract_outlines(ecluster)
   2.136    RETURNS SETOF epoint[]
   2.137    LANGUAGE sql IMMUTABLE STRICT AS $$
   2.138      SELECT (
   2.139 -      SELECT array_agg("m2"[1]::epoint)
   2.140 -      FROM regexp_matches("m1"[2], e'[^ ]+ [^ ]+', 'g') AS "m2"
   2.141 +      SELECT pg_catalog.array_agg("m2"[1]::@extschema@.epoint)
   2.142 +      FROM pg_catalog.regexp_matches("m1"[2], e'[^ ]+ [^ ]+', 'g') AS "m2"
   2.143      )
   2.144 -    FROM regexp_matches($1::text, e'(^| )outline \\(([^)]+)\\)', 'g') AS "m1"
   2.145 +    FROM pg_catalog.regexp_matches(
   2.146 +      $1::pg_catalog.text, e'(^| )outline \\(([^)]+)\\)', 'g'
   2.147 +    ) AS "m1"
   2.148    $$;
   2.149  
   2.150  CREATE FUNCTION ecluster_extract_polygons(ecluster)
   2.151    RETURNS SETOF epoint[]
   2.152    LANGUAGE sql IMMUTABLE STRICT AS $$
   2.153      SELECT (
   2.154 -      SELECT array_agg("m2"[1]::epoint)
   2.155 -      FROM regexp_matches("m1"[2], e'[^ ]+ [^ ]+', 'g') AS "m2"
   2.156 +      SELECT pg_catalog.array_agg("m2"[1]::@extschema@.epoint)
   2.157 +      FROM pg_catalog.regexp_matches("m1"[2], e'[^ ]+ [^ ]+', 'g') AS "m2"
   2.158      )
   2.159 -    FROM regexp_matches($1::text, e'(^| )polygon \\(([^)]+)\\)', 'g') AS "m1"
   2.160 +    FROM pg_catalog.regexp_matches(
   2.161 +      $1::pg_catalog.text, e'(^| )polygon \\(([^)]+)\\)', 'g'
   2.162 +    ) AS "m1"
   2.163    $$;
   2.164  
   2.165  
   2.166 @@ -852,7 +883,7 @@
   2.167  
   2.168  CREATE FUNCTION epoint_ebox_overlap_commutator(ebox, epoint)
   2.169    RETURNS boolean
   2.170 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 && $1';
   2.171 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&) $1';
   2.172  
   2.173  CREATE OPERATOR && (
   2.174    leftarg = ebox,
   2.175 @@ -874,7 +905,7 @@
   2.176  
   2.177  CREATE FUNCTION epoint_ecircle_overlap_commutator(ecircle, epoint)
   2.178    RETURNS boolean
   2.179 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 && $1';
   2.180 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&) $1';
   2.181  
   2.182  CREATE OPERATOR && (
   2.183    leftarg = ecircle,
   2.184 @@ -896,7 +927,7 @@
   2.185  
   2.186  CREATE FUNCTION epoint_ecluster_overlap_commutator(ecluster, epoint)
   2.187    RETURNS boolean
   2.188 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 && $1';
   2.189 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&) $1';
   2.190  
   2.191  CREATE OPERATOR && (
   2.192    leftarg = ecluster,
   2.193 @@ -936,7 +967,7 @@
   2.194  
   2.195  CREATE FUNCTION ecircle_ecluster_overlap_commutator(ecluster, ecircle)
   2.196    RETURNS boolean
   2.197 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 && $1';
   2.198 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&) $1';
   2.199  
   2.200  CREATE OPERATOR && (
   2.201    leftarg = ecluster,
   2.202 @@ -958,7 +989,8 @@
   2.203  
   2.204  CREATE FUNCTION ebox_ecircle_overlap_castwrap(ebox, ecircle)
   2.205    RETURNS boolean
   2.206 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1::ecluster && $2';
   2.207 +  LANGUAGE sql IMMUTABLE
   2.208 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.&&) $2';
   2.209  
   2.210  CREATE OPERATOR && (
   2.211    leftarg = ebox,
   2.212 @@ -971,7 +1003,8 @@
   2.213  
   2.214  CREATE FUNCTION ebox_ecircle_overlap_castwrap(ecircle, ebox)
   2.215    RETURNS boolean
   2.216 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 && $2::ecluster';
   2.217 +  LANGUAGE sql IMMUTABLE
   2.218 +  AS 'SELECT $1 OPERATOR(@extschema@.&&) $2::@extschema@.ecluster';
   2.219  
   2.220  CREATE OPERATOR && (
   2.221    leftarg = ecircle,
   2.222 @@ -984,7 +1017,8 @@
   2.223  
   2.224  CREATE FUNCTION ebox_ecluster_overlap_castwrap(ebox, ecluster)
   2.225    RETURNS boolean
   2.226 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1::ecluster && $2';
   2.227 +  LANGUAGE sql IMMUTABLE
   2.228 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.&&) $2';
   2.229  
   2.230  CREATE OPERATOR && (
   2.231    leftarg = ebox,
   2.232 @@ -997,7 +1031,8 @@
   2.233  
   2.234  CREATE FUNCTION ebox_ecluster_overlap_castwrap(ecluster, ebox)
   2.235    RETURNS boolean
   2.236 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 && $2::ecluster';
   2.237 +  LANGUAGE sql IMMUTABLE
   2.238 +  AS 'SELECT $1 OPERATOR(@extschema@.&&) $2::@extschema@.ecluster';
   2.239  
   2.240  CREATE OPERATOR && (
   2.241    leftarg = ecluster,
   2.242 @@ -1019,7 +1054,7 @@
   2.243  
   2.244  CREATE FUNCTION epoint_ecluster_may_overlap_commutator(ecluster, epoint)
   2.245    RETURNS boolean
   2.246 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 &&+ $1';
   2.247 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&+) $1';
   2.248  
   2.249  CREATE OPERATOR &&+ (
   2.250    leftarg = ecluster,
   2.251 @@ -1041,7 +1076,7 @@
   2.252  
   2.253  CREATE FUNCTION ebox_ecircle_may_overlap_commutator(ecircle, ebox)
   2.254    RETURNS boolean
   2.255 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 &&+ $1';
   2.256 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&+) $1';
   2.257  
   2.258  CREATE OPERATOR &&+ (
   2.259    leftarg = ecircle,
   2.260 @@ -1063,7 +1098,7 @@
   2.261  
   2.262  CREATE FUNCTION ebox_ecluster_may_overlap_commutator(ecluster, ebox)
   2.263    RETURNS boolean
   2.264 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 &&+ $1';
   2.265 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&+) $1';
   2.266  
   2.267  CREATE OPERATOR &&+ (
   2.268    leftarg = ecluster,
   2.269 @@ -1085,7 +1120,7 @@
   2.270  
   2.271  CREATE FUNCTION ecircle_ecluster_may_overlap_commutator(ecluster, ecircle)
   2.272    RETURNS boolean
   2.273 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 &&+ $1';
   2.274 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.&&+) $1';
   2.275  
   2.276  CREATE OPERATOR &&+ (
   2.277    leftarg = ecluster,
   2.278 @@ -1152,7 +1187,7 @@
   2.279  
   2.280  CREATE FUNCTION ecluster_contains_commutator(ecluster, ecluster)
   2.281    RETURNS boolean
   2.282 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 @> $1';
   2.283 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.@>) $1';
   2.284  
   2.285  CREATE OPERATOR <@ (
   2.286    leftarg = ecluster,
   2.287 @@ -1165,7 +1200,10 @@
   2.288  
   2.289  CREATE FUNCTION ebox_contains_castwrap(ebox, ebox)
   2.290    RETURNS boolean
   2.291 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1::ecluster @> $2::ecluster';
   2.292 +  LANGUAGE sql IMMUTABLE AS $$
   2.293 +    SELECT
   2.294 +    $1::@extschema@.ecluster OPERATOR(@extschema@.@>) $2::@extschema@.ecluster
   2.295 +  $$;
   2.296  
   2.297  CREATE OPERATOR @> (
   2.298    leftarg = ebox,
   2.299 @@ -1178,7 +1216,10 @@
   2.300  
   2.301  CREATE FUNCTION ebox_contains_swapped_castwrap(ebox, ebox)
   2.302    RETURNS boolean
   2.303 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2::ecluster @> $1::ecluster';
   2.304 +  LANGUAGE sql IMMUTABLE AS $$
   2.305 +    SELECT
   2.306 +    $2::@extschema@.ecluster OPERATOR(@extschema@.@>) $1::@extschema@.ecluster
   2.307 +  $$;
   2.308  
   2.309  CREATE OPERATOR <@ (
   2.310    leftarg = ebox,
   2.311 @@ -1191,7 +1232,8 @@
   2.312  
   2.313  CREATE FUNCTION ebox_ecluster_contains_castwrap(ebox, ecluster)
   2.314    RETURNS boolean
   2.315 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1::ecluster @> $2';
   2.316 +  LANGUAGE sql IMMUTABLE
   2.317 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.@>) $2';
   2.318  
   2.319  CREATE OPERATOR @> (
   2.320    leftarg = ebox,
   2.321 @@ -1204,7 +1246,8 @@
   2.322  
   2.323  CREATE FUNCTION ebox_ecluster_contains_castwrap(ecluster, ebox)
   2.324    RETURNS boolean
   2.325 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2::ecluster @> $1';
   2.326 +  LANGUAGE sql IMMUTABLE
   2.327 +  AS 'SELECT $2::@extschema@.ecluster OPERATOR(@extschema@.@>) $1';
   2.328  
   2.329  CREATE OPERATOR <@ (
   2.330    leftarg = ecluster,
   2.331 @@ -1217,7 +1260,8 @@
   2.332  
   2.333  CREATE FUNCTION ecluster_ebox_contains_castwrap(ecluster, ebox)
   2.334    RETURNS boolean
   2.335 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 @> $2::ecluster';
   2.336 +  LANGUAGE sql IMMUTABLE
   2.337 +  AS 'SELECT $1 OPERATOR(@extschema@.@>) $2::@extschema@.ecluster';
   2.338  
   2.339  CREATE OPERATOR @> (
   2.340    leftarg = ecluster,
   2.341 @@ -1230,7 +1274,8 @@
   2.342  
   2.343  CREATE FUNCTION ecluster_ebox_contains_castwrap(ebox, ecluster)
   2.344    RETURNS boolean
   2.345 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 @> $1::ecluster';
   2.346 +  LANGUAGE sql IMMUTABLE
   2.347 +  AS 'SELECT $2 OPERATOR(@extschema@.@>) $1::@extschema@.ecluster';
   2.348  
   2.349  CREATE OPERATOR <@ (
   2.350    leftarg = ebox,
   2.351 @@ -1257,7 +1302,7 @@
   2.352  
   2.353  CREATE FUNCTION epoint_ecircle_distance_commutator(ecircle, epoint)
   2.354    RETURNS float8
   2.355 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 <-> $1';
   2.356 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.<->) $1';
   2.357  
   2.358  CREATE OPERATOR <-> (
   2.359    leftarg = ecircle,
   2.360 @@ -1275,7 +1320,7 @@
   2.361  
   2.362  CREATE FUNCTION epoint_ecluster_distance_commutator(ecluster, epoint)
   2.363    RETURNS float8
   2.364 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 <-> $1';
   2.365 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.<->) $1';
   2.366  
   2.367  CREATE OPERATOR <-> (
   2.368    leftarg = ecluster,
   2.369 @@ -1300,7 +1345,7 @@
   2.370  
   2.371  CREATE FUNCTION ecircle_ecluster_distance_commutator(ecluster, ecircle)
   2.372    RETURNS float8
   2.373 -  LANGUAGE sql IMMUTABLE AS 'SELECT $2 <-> $1';
   2.374 +  LANGUAGE sql IMMUTABLE AS 'SELECT $2 OPERATOR(@extschema@.<->) $1';
   2.375  
   2.376  CREATE OPERATOR <-> (
   2.377    leftarg = ecluster,
   2.378 @@ -1318,7 +1363,8 @@
   2.379  
   2.380  CREATE FUNCTION epoint_ebox_distance_castwrap(epoint, ebox)
   2.381    RETURNS float8
   2.382 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 <-> $2::ecluster';
   2.383 +  LANGUAGE sql IMMUTABLE
   2.384 +  AS 'SELECT $1 OPERATOR(@extschema@.<->) $2::@extschema@.ecluster';
   2.385  
   2.386  CREATE OPERATOR <-> (
   2.387    leftarg = epoint,
   2.388 @@ -1329,7 +1375,8 @@
   2.389  
   2.390  CREATE FUNCTION epoint_ebox_distance_castwrap(ebox, epoint)
   2.391    RETURNS float8
   2.392 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1::ecluster <-> $2';
   2.393 +  LANGUAGE sql IMMUTABLE
   2.394 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.<->) $2';
   2.395  
   2.396  CREATE OPERATOR <-> (
   2.397    leftarg = ebox,
   2.398 @@ -1340,7 +1387,10 @@
   2.399  
   2.400  CREATE FUNCTION ebox_distance_castwrap(ebox, ebox)
   2.401    RETURNS float8
   2.402 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1::ecluster <-> $2::ecluster';
   2.403 +  LANGUAGE sql IMMUTABLE AS $$
   2.404 +    SELECT
   2.405 +    $1::@extschema@.ecluster OPERATOR(@extschema@.<->) $2::@extschema@.ecluster
   2.406 +  $$;
   2.407  
   2.408  CREATE OPERATOR <-> (
   2.409    leftarg = ebox,
   2.410 @@ -1351,7 +1401,8 @@
   2.411  
   2.412  CREATE FUNCTION ebox_ecircle_distance_castwrap(ebox, ecircle)
   2.413    RETURNS float8
   2.414 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1::ecluster <-> $2';
   2.415 +  LANGUAGE sql IMMUTABLE
   2.416 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.<->) $2';
   2.417  
   2.418  CREATE OPERATOR <-> (
   2.419    leftarg = ebox,
   2.420 @@ -1362,7 +1413,8 @@
   2.421  
   2.422  CREATE FUNCTION ebox_ecircle_distance_castwrap(ecircle, ebox)
   2.423    RETURNS float8
   2.424 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 <-> $2::ecluster';
   2.425 +  LANGUAGE sql IMMUTABLE
   2.426 +  AS 'SELECT $1 OPERATOR(@extschema@.<->) $2::@extschema@.ecluster';
   2.427  
   2.428  CREATE OPERATOR <-> (
   2.429    leftarg = ecircle,
   2.430 @@ -1373,7 +1425,8 @@
   2.431  
   2.432  CREATE FUNCTION ebox_ecluster_distance_castwrap(ebox, ecluster)
   2.433    RETURNS float8
   2.434 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1::ecluster <-> $2';
   2.435 +  LANGUAGE sql IMMUTABLE
   2.436 +  AS 'SELECT $1::@extschema@.ecluster OPERATOR(@extschema@.<->) $2';
   2.437  
   2.438  CREATE OPERATOR <-> (
   2.439    leftarg = ebox,
   2.440 @@ -1384,7 +1437,8 @@
   2.441  
   2.442  CREATE FUNCTION ebox_ecluster_distance_castwrap(ecluster, ebox)
   2.443    RETURNS float8
   2.444 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 <-> $2::ecluster';
   2.445 +  LANGUAGE sql IMMUTABLE
   2.446 +  AS 'SELECT $1 OPERATOR(@extschema@.<->) $2::@extschema@.ecluster';
   2.447  
   2.448  CREATE OPERATOR <-> (
   2.449    leftarg = ecluster,
   2.450 @@ -1537,23 +1591,28 @@
   2.451  
   2.452  CREATE FUNCTION distance(epoint, epoint)
   2.453    RETURNS float8
   2.454 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 <-> $2';
   2.455 +  LANGUAGE sql IMMUTABLE AS 'SELECT $1 OPERATOR(@extschema@.<->) $2';
   2.456  
   2.457  CREATE FUNCTION distance(ecluster, epoint)
   2.458    RETURNS float8
   2.459 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 <-> $2';
   2.460 +  LANGUAGE sql IMMUTABLE AS 'SELECT $1 OPERATOR(@extschema@.<->) $2';
   2.461  
   2.462  CREATE FUNCTION distance_within(epoint, epoint, float8)
   2.463    RETURNS boolean
   2.464 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 && ecircle($2, $3)';
   2.465 +  LANGUAGE sql IMMUTABLE
   2.466 +  AS 'SELECT $1 OPERATOR(@extschema@.&&) @extschema@.ecircle($2, $3)';
   2.467  
   2.468  CREATE FUNCTION distance_within(ecluster, epoint, float8)
   2.469    RETURNS boolean
   2.470 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 && ecircle($2, $3)';
   2.471 +  LANGUAGE sql IMMUTABLE
   2.472 +  AS 'SELECT $1 OPERATOR(@extschema@.&&) @extschema@.ecircle($2, $3)';
   2.473  
   2.474  CREATE FUNCTION fair_distance(ecluster, epoint, int4 = 10000)
   2.475    RETURNS float8
   2.476 -  LANGUAGE sql IMMUTABLE AS 'SELECT $1 <=> epoint_with_sample_count($2, $3)';
   2.477 +  LANGUAGE sql IMMUTABLE AS $$
   2.478 +    SELECT
   2.479 +    $1 OPERATOR(@extschema@.<=>) @extschema@.epoint_with_sample_count($2, $3)
   2.480 +  $$;
   2.481  
   2.482  
   2.483  --------------------------------
   2.484 @@ -1564,17 +1623,21 @@
   2.485    RETURNS epoint
   2.486    LANGUAGE plpgsql IMMUTABLE STRICT AS $$
   2.487      DECLARE
   2.488 -      "result" epoint;
   2.489 +      "result" @extschema@.epoint;
   2.490      BEGIN
   2.491 -      IF $3 = 'epoint_lonlat' THEN
   2.492 +      IF $3 OPERATOR(pg_catalog.=) 'epoint_lonlat' THEN
   2.493          -- avoid dynamic command execution for better performance
   2.494 -        RETURN epoint($2, $1);
   2.495 +        RETURN @extschema@.epoint($2, $1);
   2.496        END IF;
   2.497 -      IF $3 = 'epoint' OR $3 = 'epoint_latlon' THEN
   2.498 +      IF
   2.499 +        $3 OPERATOR(pg_catalog.=) 'epoint' OR
   2.500 +        $3 OPERATOR(pg_catalog.=) 'epoint_latlon'
   2.501 +      THEN
   2.502          -- avoid dynamic command execution for better performance
   2.503 -        RETURN epoint($1, $2);
   2.504 +        RETURN @extschema@.epoint($1, $2);
   2.505        END IF;
   2.506 -      EXECUTE 'SELECT ' || $3 || '($1, $2)' INTO STRICT "result" USING $1, $2;
   2.507 +      EXECUTE
   2.508 +        'SELECT ' OPERATOR(pg_catalog.||) $3 OPERATOR(pg_catalog.||) '($1, $2)'         INTO STRICT "result" USING $1, $2;
   2.509        RETURN "result";
   2.510      END;
   2.511    $$;
   2.512 @@ -1583,16 +1646,21 @@
   2.513    RETURNS SETOF jsonb
   2.514    LANGUAGE sql IMMUTABLE STRICT AS $$
   2.515      SELECT "result" FROM
   2.516 -      ( SELECT jsonb_array_length($1) - 1 ) AS "lastindex_row" ("lastindex")
   2.517 -      CROSS JOIN LATERAL jsonb_array_elements(
   2.518 +      ( SELECT pg_catalog.jsonb_array_length($1) - 1 )
   2.519 +      AS "lastindex_row" ("lastindex")
   2.520 +      CROSS JOIN LATERAL pg_catalog.jsonb_array_elements(
   2.521          CASE WHEN
   2.522 -          coords_to_epoint(
   2.523 -            ($1->0->>0)::float8,
   2.524 -            ($1->0->>1)::float8,
   2.525 +          @extschema@.coords_to_epoint(
   2.526 +            ($1 OPERATOR(pg_catalog.->) 0 OPERATOR(pg_catalog.->>) 0)
   2.527 +            ::pg_catalog.float8,
   2.528 +            ($1 OPERATOR(pg_catalog.->) 0 OPERATOR(pg_catalog.->>) 1)
   2.529 +            ::pg_catalog.float8,
   2.530              $2
   2.531 -          ) = coords_to_epoint(
   2.532 -            ($1->"lastindex"->>0)::float8,
   2.533 -            ($1->"lastindex"->>1)::float8,
   2.534 +          ) OPERATOR(pg_catalog.=) @extschema@.coords_to_epoint(
   2.535 +            ($1 OPERATOR(pg_catalog.->) "lastindex" OPERATOR(pg_catalog.->>) 0)
   2.536 +            ::pg_catalog.float8,
   2.537 +            ($1 OPERATOR(pg_catalog.->) "lastindex" OPERATOR(pg_catalog.->>) 1)
   2.538 +            ::pg_catalog.float8,
   2.539              $2
   2.540            )
   2.541          THEN
   2.542 @@ -1607,14 +1675,16 @@
   2.543    RETURNS epoint
   2.544    LANGUAGE sql IMMUTABLE STRICT AS $$
   2.545      SELECT CASE
   2.546 -    WHEN $1->>'type' = 'Point' THEN
   2.547 -      coords_to_epoint(
   2.548 -        ($1->'coordinates'->>0)::float8,
   2.549 -        ($1->'coordinates'->>1)::float8,
   2.550 +    WHEN $1 OPERATOR(pg_catalog.->>) 'type' OPERATOR(pg_catalog.=) 'Point' THEN
   2.551 +      @extschema@.coords_to_epoint(
   2.552 +        ($1 OPERATOR(pg_catalog.->) 'coordinates' OPERATOR(pg_catalog.->>) 0)
   2.553 +        ::pg_catalog.float8,
   2.554 +        ($1 OPERATOR(pg_catalog.->) 'coordinates' OPERATOR(pg_catalog.->>) 1)
   2.555 +        ::pg_catalog.float8,
   2.556          $2
   2.557        )
   2.558      WHEN $1->>'type' = 'Feature' THEN
   2.559 -      GeoJSON_to_epoint($1->'geometry', $2)
   2.560 +      @extschema@.GeoJSON_to_epoint($1 OPERATOR(pg_catalog.->) 'geometry', $2)
   2.561      ELSE
   2.562        NULL
   2.563      END
   2.564 @@ -1623,92 +1693,113 @@
   2.565  CREATE FUNCTION GeoJSON_to_ecluster(jsonb, text = 'epoint_lonlat')
   2.566    RETURNS ecluster
   2.567    LANGUAGE sql IMMUTABLE STRICT AS $$
   2.568 -    SELECT CASE $1->>'type'
   2.569 +    SELECT CASE $1 OPERATOR(pg_catalog.->>) 'type'
   2.570      WHEN 'Point' THEN
   2.571 -      coords_to_epoint(
   2.572 -        ($1->'coordinates'->>0)::float8,
   2.573 -        ($1->'coordinates'->>1)::float8,
   2.574 +      @extschema@.coords_to_epoint(
   2.575 +        ($1 OPERATOR(pg_catalog.->) 'coordinates' OPERATOR(pg_catalog.->>) 0)
   2.576 +        ::pg_catalog.float8,
   2.577 +        ($1 OPERATOR(pg_catalog.->) 'coordinates' OPERATOR(pg_catalog.->>) 1)
   2.578 +        ::pg_catalog.float8,
   2.579          $2
   2.580 -      )::ecluster
   2.581 +      )::@extschema@.ecluster
   2.582      WHEN 'MultiPoint' THEN
   2.583 -      ( SELECT ecluster_create_multipoint(array_agg(
   2.584 -          coords_to_epoint(
   2.585 -            ("coord"->>0)::float8,
   2.586 -            ("coord"->>1)::float8,
   2.587 +      ( SELECT @extschema@.ecluster_create_multipoint(pg_catalog.array_agg(
   2.588 +          @extschema@.coords_to_epoint(
   2.589 +            ("coord" OPERATOR(pg_catalog.->>) 0)::pg_catalog.float8,
   2.590 +            ("coord" OPERATOR(pg_catalog.->>) 1)::pg_catalog.float8,
   2.591              $2
   2.592            )
   2.593          ))
   2.594 -        FROM jsonb_array_elements($1->'coordinates') AS "coord"
   2.595 +        FROM pg_catalog.jsonb_array_elements(
   2.596 +          $1 OPERATOR(pg_catalog.->) 'coordinates'
   2.597 +        ) AS "coord"
   2.598        )
   2.599      WHEN 'LineString' THEN
   2.600 -      ( SELECT ecluster_create_path(array_agg(
   2.601 -          coords_to_epoint(
   2.602 -            ("coord"->>0)::float8,
   2.603 -            ("coord"->>1)::float8,
   2.604 +      ( SELECT @extschema@.ecluster_create_path(pg_catalog.array_agg(
   2.605 +          @extschema@.coords_to_epoint(
   2.606 +            ("coord" OPERATOR(pg_catalog.->>) 0)::pg_catalog.float8,
   2.607 +            ("coord" OPERATOR(pg_catalog.->>) 1)::pg_catalog.float8,
   2.608              $2
   2.609            )
   2.610          ))
   2.611 -        FROM jsonb_array_elements($1->'coordinates') AS "coord"
   2.612 +        FROM pg_catalog.jsonb_array_elements(
   2.613 +          $1 OPERATOR(pg_catalog.->) 'coordinates'
   2.614 +        ) AS "coord"
   2.615        )
   2.616      WHEN 'MultiLineString' THEN
   2.617 -      ( SELECT ecluster_concat(array_agg(
   2.618 -          ( SELECT ecluster_create_path(array_agg(
   2.619 +      ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   2.620 +          ( SELECT @extschema@.ecluster_create_path(pg_catalog.array_agg(
   2.621                coords_to_epoint(
   2.622 -                ("coord"->>0)::float8,
   2.623 -                ("coord"->>1)::float8,
   2.624 +                ("coord" OPERATOR(pg_catalog.->>) 0)::pg_catalog.float8,
   2.625 +                ("coord" OPERATOR(pg_catalog.->>) 1)::pg_catalog.float8,
   2.626                  $2
   2.627                )
   2.628              ))
   2.629 -            FROM jsonb_array_elements("coord_array") AS "coord"
   2.630 +            FROM pg_catalog.jsonb_array_elements("coord_array") AS "coord"
   2.631            )
   2.632          ))
   2.633 -        FROM jsonb_array_elements($1->'coordinates') AS "coord_array"
   2.634 +        FROM pg_catalog.jsonb_array_elements(
   2.635 +          $1 OPERATOR(pg_catalog.->) 'coordinates'
   2.636 +        ) AS "coord_array"
   2.637        )
   2.638      WHEN 'Polygon' THEN
   2.639 -      ( SELECT ecluster_concat(array_agg(
   2.640 -          ( SELECT ecluster_create_polygon(array_agg(
   2.641 -              coords_to_epoint(
   2.642 -                ("coord"->>0)::float8,
   2.643 -                ("coord"->>1)::float8,
   2.644 +      ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   2.645 +          ( SELECT @extschema@.ecluster_create_polygon(pg_catalog.array_agg(
   2.646 +              @extschema@.coords_to_epoint(
   2.647 +                ("coord" OPERATOR(pg_catalog.->>) 0)::pg_catalog.float8,
   2.648 +                ("coord" OPERATOR(pg_catalog.->>) 1)::pg_catalog.float8,
   2.649                  $2
   2.650                )
   2.651              ))
   2.652 -            FROM GeoJSON_LinearRing_vertices("coord_array", $2) AS "coord"
   2.653 +            FROM @extschema@.GeoJSON_LinearRing_vertices("coord_array", $2)
   2.654 +            AS "coord"
   2.655            )
   2.656          ))
   2.657 -        FROM jsonb_array_elements($1->'coordinates') AS "coord_array"
   2.658 +        FROM pg_catalog.jsonb_array_elements(
   2.659 +          $1 OPERATOR(pg_catalog.->) 'coordinates'
   2.660 +        ) AS "coord_array"
   2.661        )
   2.662      WHEN 'MultiPolygon' THEN
   2.663 -      ( SELECT ecluster_concat(array_agg(
   2.664 -          ( SELECT ecluster_concat(array_agg(
   2.665 -              ( SELECT ecluster_create_polygon(array_agg(
   2.666 -                  coords_to_epoint(
   2.667 -                    ("coord"->>0)::float8,
   2.668 -                    ("coord"->>1)::float8,
   2.669 +      ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   2.670 +          ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   2.671 +              ( SELECT pg_catalog.ecluster_create_polygon(pg_catalog.array_agg(
   2.672 +                  @extschema@.coords_to_epoint(
   2.673 +                    ("coord" OPERATOR(pg_catalog.->>) 0)::pg_catalog.float8,
   2.674 +                    ("coord" OPERATOR(pg_catalog.->>) 1)::pg_catalog.float8,
   2.675                      $2
   2.676                    )
   2.677                  ))
   2.678 -                FROM GeoJSON_LinearRing_vertices("coord_array", $2) AS "coord"
   2.679 +                FROM @extschema@.GeoJSON_LinearRing_vertices("coord_array", $2)
   2.680 +                AS "coord"
   2.681                )
   2.682              ))
   2.683 -            FROM jsonb_array_elements("coord_array_array") AS "coord_array"
   2.684 +            FROM pg_catalog.jsonb_array_elements("coord_array_array")
   2.685 +            AS "coord_array"
   2.686            )
   2.687          ))
   2.688 -        FROM jsonb_array_elements($1->'coordinates') AS "coord_array_array"
   2.689 +        FROM jsonb_array_elements(
   2.690 +          $1 OPERATOR(pg_catalog.->) 'coordinates'
   2.691 +        ) AS "coord_array_array"
   2.692        )
   2.693      WHEN 'GeometryCollection' THEN
   2.694 -      ( SELECT ecluster_concat(array_agg(
   2.695 -          GeoJSON_to_ecluster("geometry", $2)
   2.696 +      ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   2.697 +          @extschema@.GeoJSON_to_ecluster("geometry", $2)
   2.698          ))
   2.699 -        FROM jsonb_array_elements($1->'geometries') AS "geometry"
   2.700 +        FROM pg_catalog.jsonb_array_elements(
   2.701 +          $1 OPERATOR(pg_catalog.->) 'geometries'
   2.702 +        ) AS "geometry"
   2.703        )
   2.704      WHEN 'Feature' THEN
   2.705 -      GeoJSON_to_ecluster($1->'geometry', $2)
   2.706 +      @extschema@.GeoJSON_to_ecluster(
   2.707 +        $1 OPERATOR(pg_catalog.->) 'geometry', $2
   2.708 +      )
   2.709      WHEN 'FeatureCollection' THEN
   2.710 -      ( SELECT ecluster_concat(array_agg(
   2.711 -          GeoJSON_to_ecluster("feature", $2)
   2.712 +      ( SELECT @extschema@.ecluster_concat(pg_catalog.array_agg(
   2.713 +          @extschema@.GeoJSON_to_ecluster("feature", $2)
   2.714          ))
   2.715 -        FROM jsonb_array_elements($1->'features') AS "feature"
   2.716 +        FROM pg_catalog.jsonb_array_elements(
   2.717 +          $1 OPERATOR(pg_catalog.->) 'features'
   2.718 +        ) AS "feature"
   2.719        )
   2.720      ELSE
   2.721        NULL
     3.1 --- a/latlon.control	Wed Feb 12 13:11:04 2020 +0100
     3.2 +++ b/latlon.control	Sun Nov 29 19:55:33 2020 +0100
     3.3 @@ -1,3 +1,4 @@
     3.4  comment = 'Geographic data types and spatial indexing for the WGS-84 spheroid'
     3.5  default_version = '0.15'
     3.6 -relocatable = true
     3.7 +trusted = true
     3.8 +relocatable = false

Impressum / About Us