Project

General

Profile

« Previous | Next » 

Revision 2107

schemas/functions.sql: Added _toDouble

View differences:

functions.sql
16 16
CREATE SCHEMA functions;
17 17

  
18 18

  
19
SET search_path = functions, pg_catalog;
20

  
19 21
--
22
-- Name: _toDouble(); Type: FUNCTION; Schema: functions; Owner: -
23
--
24

  
25
CREATE FUNCTION "_toDouble"() RETURNS trigger
26
    LANGUAGE plpgsql
27
    AS $$
28
BEGIN
29
    new.result := CAST(new.value AS double precision);
30
    RETURN new;
31
END;
32
$$;
33

  
34

  
35
SET default_tablespace = '';
36

  
37
SET default_with_oids = false;
38

  
39
--
40
-- Name: _toDouble; Type: TABLE; Schema: functions; Owner: -; Tablespace: 
41
--
42

  
43
CREATE TABLE "_toDouble" (
44
    result double precision,
45
    value text
46
);
47

  
48

  
49
--
50
-- Name: _toDouble_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace: 
51
--
52

  
53
CREATE UNIQUE INDEX "_toDouble_unique" ON "_toDouble" USING btree ((COALESCE(value, '\\N'::text)));
54

  
55

  
56
--
57
-- Name: _toDouble; Type: TRIGGER; Schema: functions; Owner: -
58
--
59

  
60
CREATE TRIGGER "_toDouble" BEFORE INSERT OR UPDATE ON "_toDouble" FOR EACH ROW EXECUTE PROCEDURE "_toDouble"();
61

  
62

  
63
--
20 64
-- PostgreSQL database dump complete
21 65
--
22 66

  

Also available in: Unified diff