]>
Commit | Line | Data |
---|---|---|
0f660cfd JF |
1 | \echo Use "CREATE EXTENSION timeuuid" to load this file. \quit |
2 | ||
3 | create type timeuuid; | |
4 | ||
5 | create or replace function timeuuid_in(cstring) returns timeuuid | |
6 | as 'uuid_in' language internal immutable strict; | |
7 | create or replace function timeuuid_out(timeuuid) returns cstring | |
8 | as 'uuid_out' language internal immutable strict; | |
9 | ||
10 | create or replace function timeuuid_recv(internal) returns timeuuid | |
11 | as 'uuid_recv' language internal immutable strict; | |
12 | create or replace function timeuuid_send(timeuuid) returns bytea | |
13 | as 'uuid_send' language internal immutable strict; | |
14 | ||
15 | create type timeuuid ( | |
16 | input = timeuuid_in, | |
17 | output = timeuuid_out, | |
18 | receive = timeuuid_recv, | |
19 | send = timeuuid_send, | |
20 | like = uuid | |
21 | ); | |
22 | ||
23 | create or replace function timeuuid_eq(timeuuid, timeuuid) returns boolean | |
24 | as 'uuid_eq' language internal immutable strict; | |
25 | create or replace function timeuuid_neq(timeuuid, timeuuid) returns boolean | |
26 | as 'uuid_ne' language internal immutable strict; | |
27 | ||
28 | create or replace function timeuuid_hash(timeuuid) returns int4 | |
29 | as 'uuid_hash' language internal immutable strict; | |
30 | ||
31 | create function timeuuid_lt(timeuuid, timeuuid) returns boolean | |
32 | as 'MODULE_PATHNAME' language c strict immutable; | |
33 | create function timeuuid_gt(timeuuid, timeuuid) returns boolean | |
34 | as 'MODULE_PATHNAME' language c strict immutable; | |
35 | create function timeuuid_le(timeuuid, timeuuid) returns boolean | |
36 | as 'MODULE_PATHNAME' language c strict immutable; | |
37 | create function timeuuid_ge(timeuuid, timeuuid) returns boolean | |
38 | as 'MODULE_PATHNAME' language c strict immutable; | |
39 | ||
40 | create function timeuuid_cmp(timeuuid, timeuuid) returns int4 | |
41 | as 'MODULE_PATHNAME' language c strict immutable; | |
42 | ||
43 | create operator = ( | |
44 | leftarg = timeuuid, | |
45 | rightarg = timeuuid, | |
46 | commutator = =, | |
47 | negator = <>, | |
48 | procedure = timeuuid_eq, | |
49 | restrict = eqsel, | |
50 | join = eqjoinsel, | |
51 | hashes, | |
52 | merges | |
53 | ); | |
54 | ||
55 | create operator <> ( | |
56 | leftarg = timeuuid, | |
57 | rightarg = timeuuid, | |
58 | commutator = <>, | |
59 | negator = =, | |
60 | procedure = timeuuid_neq, | |
61 | restrict = neqsel, | |
62 | join = neqjoinsel | |
63 | ); | |
64 | ||
65 | create operator < ( | |
66 | leftarg = timeuuid, | |
67 | rightarg = timeuuid, | |
68 | commutator = >, | |
69 | negator = >=, | |
70 | procedure = timeuuid_lt, | |
71 | restrict = scalarltsel, | |
72 | join = scalarltjoinsel | |
73 | ); | |
74 | ||
75 | create operator > ( | |
76 | leftarg = timeuuid, | |
77 | rightarg = timeuuid, | |
78 | commutator = <, | |
79 | negator = <=, | |
80 | procedure = timeuuid_gt, | |
81 | restrict = scalargtsel, | |
82 | join = scalargtjoinsel | |
83 | ); | |
84 | ||
85 | create operator <= ( | |
86 | leftarg = timeuuid, | |
87 | rightarg = timeuuid, | |
88 | commutator = >=, | |
89 | negator = >, | |
90 | procedure = timeuuid_le, | |
91 | restrict = scalarltsel, | |
92 | join = scalarltjoinsel | |
93 | ); | |
94 | ||
95 | create operator >= ( | |
96 | leftarg = timeuuid, | |
97 | rightarg = timeuuid, | |
98 | commutator = <=, | |
99 | negator = <, | |
100 | procedure = timeuuid_ge, | |
101 | restrict = scalargtsel, | |
102 | join = scalargtjoinsel | |
103 | ); | |
104 | ||
105 | create operator class timeuuid_ops | |
106 | default for type timeuuid using btree as | |
107 | operator 1 <, | |
108 | operator 2 <=, | |
109 | operator 3 =, | |
110 | operator 4 >=, | |
111 | operator 5 >, | |
112 | function 1 timeuuid_cmp(timeuuid, timeuuid); | |
113 | ||
114 | create cast (timeuuid as uuid) | |
115 | without function as assignment; | |
116 | create cast (uuid as timeuuid) | |
117 | without function as assignment; | |
118 | ||
119 | create function timeuuid_to_timestamptz(uuid) returns timestamptz | |
120 | as 'MODULE_PATHNAME' language c strict immutable; | |
121 | create function timeuuid_to_timestamptz(timeuuid) returns timestamptz | |
122 | as 'MODULE_PATHNAME' language c strict immutable; | |
123 | create function timestamptz_to_timeuuid(timestamptz) returns timeuuid | |
124 | as 'MODULE_PATHNAME' language c strict immutable; | |
125 | ||
126 | create cast (timeuuid as timestamptz) | |
127 | with function timeuuid_to_timestamptz(timeuuid); | |
128 | create cast (timestamptz as timeuuid) | |
129 | with function timestamptz_to_timeuuid(timestamptz); |