Project

General

Profile

1
--
2
-- PostgreSQL database dump
3
--
4

    
5
SET statement_timeout = 0;
6
SET client_encoding = 'UTF8';
7
SET standard_conforming_strings = off;
8
SET check_function_bodies = false;
9
SET client_min_messages = warning;
10
SET escape_string_warning = off;
11

    
12
--
13
-- Name: functions; Type: SCHEMA; Schema: -; Owner: -
14
--
15

    
16
CREATE SCHEMA functions;
17

    
18

    
19
SET search_path = functions, pg_catalog;
20

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

    
25
CREATE FUNCTION _alt() RETURNS trigger
26
    LANGUAGE plpgsql IMMUTABLE
27
    AS $$
28
BEGIN
29
    new.result := coalesce(new."0", new."1", new."2", new."3", new."4", new."5",
30
        new."6", new."7", new."8", new."9");
31
    RETURN new;
32
END;
33
$$;
34

    
35

    
36
--
37
-- Name: boolean(text); Type: FUNCTION; Schema: functions; Owner: -
38
--
39

    
40
CREATE FUNCTION "boolean"(value text) RETURNS boolean
41
    LANGUAGE plpgsql IMMUTABLE STRICT
42
    AS $$
43
BEGIN
44
    BEGIN
45
        RETURN value::boolean;
46
    EXCEPTION
47
        WHEN data_exception THEN
48
            RAISE WARNING '%', SQLERRM;
49
            RETURN NULL;
50
    END;
51
    RETURN new;
52
END;
53
$$;
54

    
55

    
56
--
57
-- Name: double precision(text); Type: FUNCTION; Schema: functions; Owner: -
58
--
59

    
60
CREATE FUNCTION "double precision"(value text) RETURNS double precision
61
    LANGUAGE plpgsql IMMUTABLE STRICT
62
    AS $$
63
BEGIN
64
    BEGIN
65
        RETURN value::double precision;
66
    EXCEPTION
67
        WHEN data_exception THEN
68
            RAISE WARNING '%', SQLERRM;
69
            RETURN NULL;
70
    END;
71
    RETURN new;
72
END;
73
$$;
74

    
75

    
76
--
77
-- Name: ensure_not_null(text); Type: FUNCTION; Schema: functions; Owner: -
78
--
79

    
80
CREATE FUNCTION ensure_not_null(value text) RETURNS text
81
    LANGUAGE sql IMMUTABLE
82
    AS $_$
83
SELECT COALESCE($1, E'\\N');
84
$_$;
85

    
86

    
87
--
88
-- Name: timestamp with time zone(text); Type: FUNCTION; Schema: functions; Owner: -
89
--
90

    
91
CREATE FUNCTION "timestamp with time zone"(value text) RETURNS timestamp with time zone
92
    LANGUAGE plpgsql IMMUTABLE STRICT
93
    AS $$
94
BEGIN
95
    BEGIN
96
        RETURN value::timestamp with time zone;
97
    EXCEPTION
98
        WHEN data_exception THEN
99
            RAISE WARNING '%', SQLERRM;
100
            RETURN NULL;
101
    END;
102
    RETURN new;
103
END;
104
$$;
105

    
106

    
107
SET default_tablespace = '';
108

    
109
SET default_with_oids = false;
110

    
111
--
112
-- Name: _alt; Type: TABLE; Schema: functions; Owner: -; Tablespace: 
113
--
114

    
115
CREATE TABLE _alt (
116
    result text,
117
    not_null_col boolean DEFAULT true NOT NULL,
118
    "0" text,
119
    "1" text,
120
    "2" text,
121
    "3" text,
122
    "4" text,
123
    "5" text,
124
    "6" text,
125
    "7" text,
126
    "8" text,
127
    "9" text
128
);
129

    
130

    
131
--
132
-- Name: _alt_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace: 
133
--
134

    
135
CREATE UNIQUE INDEX _alt_unique ON _alt USING btree (ensure_not_null("0"), ensure_not_null("1"), ensure_not_null("2"), ensure_not_null("3"), ensure_not_null("4"), ensure_not_null("5"), ensure_not_null("6"), ensure_not_null("7"), ensure_not_null("8"), ensure_not_null("9"));
136

    
137

    
138
--
139
-- Name: _alt; Type: TRIGGER; Schema: functions; Owner: -
140
--
141

    
142
CREATE TRIGGER _alt BEFORE INSERT OR UPDATE ON _alt FOR EACH ROW EXECUTE PROCEDURE _alt();
143

    
144

    
145
--
146
-- PostgreSQL database dump complete
147
--
148

    
(4-4/20)