Project

General

Profile

« Previous | Next » 

Revision 13802

schemas/util.sql: added `range` type (and cast to numrange), which allows wraparound ranges such as for geocoordinates

View differences:

trunk/schemas/util.sql
82 82

  
83 83

  
84 84
--
85
-- Name: range; Type: TYPE; Schema: util; Owner: -
86
--
87

  
88
CREATE TYPE range AS (
89
	lower numeric,
90
	upper numeric,
91
	bounds text
92
);
93

  
94

  
95
--
96
-- Name: TYPE range; Type: COMMENT; Schema: util; Owner: -
97
--
98

  
99
COMMENT ON TYPE range IS '
100
allows wraparound ranges (which use a modulus system such as geocoordinates)
101
';
102

  
103

  
104
--
85 105
-- Name: restore_views_info; Type: TYPE; Schema: util; Owner: -
86 106
--
87 107

  
......
2884 2904

  
2885 2905

  
2886 2906
--
2907
-- Name: numrange(range); Type: FUNCTION; Schema: util; Owner: -
2908
--
2909

  
2910
CREATE FUNCTION numrange(value range) RETURNS numrange
2911
    LANGUAGE sql IMMUTABLE
2912
    AS $_$
2913
SELECT numrange($1.lower, $1.upper, $1.bounds)
2914
$_$;
2915

  
2916

  
2917
--
2887 2918
-- Name: offset2row_num(integer, integer); Type: FUNCTION; Schema: util; Owner: -
2888 2919
--
2889 2920

  
......
4654 4685
);
4655 4686

  
4656 4687

  
4688
SET search_path = pg_catalog;
4689

  
4657 4690
--
4691
-- Name: CAST (util.range AS numrange); Type: CAST; Schema: pg_catalog; Owner: -
4692
--
4693

  
4694
CREATE CAST (util.range AS numrange) WITH FUNCTION util.numrange(util.range) AS IMPLICIT;
4695

  
4696

  
4697
SET search_path = util, pg_catalog;
4698

  
4699
--
4658 4700
-- Name: map; Type: TABLE; Schema: util; Owner: -; Tablespace: 
4659 4701
--
4660 4702

  

Also available in: Unified diff