-
Notifications
You must be signed in to change notification settings - Fork 14
/
period.h
103 lines (88 loc) · 3.2 KB
/
period.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* period.h
* Implements the PERIOD data type.
*
* Portions Copyright (c) 2007-2008, Jeff Davis <[email protected]>
*/
#ifndef __period_h
#define __period_h
#include "postgres.h"
#include "fmgr.h"
#include "libpq/pqformat.h"
#include "utils/timestamp.h"
#include "access/skey.h"
#include "access/gist.h"
#include "access/skey.h"
#include "access/hash.h"
#include "utils/elog.h"
#include "utils/palloc.h"
#include "utils/builtins.h"
#include "utils/inet.h"
#include <string.h>
typedef struct period {
/*
* if this is an empty interval, we put it in the
* canonical form: [0,0)
*/
/* the first number included in the interval */
TimestampTz first;
/* the next value after the last value included in the interval */
TimestampTz next;
} period;
/* return SQL INTERVAL */
Datum length_period(PG_FUNCTION_ARGS);
Datum period_offset_period_timestamptz(PG_FUNCTION_ARGS);
Datum period_offset_sec_period_timestamptz(PG_FUNCTION_ARGS);
/* return TIMESTAMPTZ */
Datum prior_period(PG_FUNCTION_ARGS);
Datum first_period(PG_FUNCTION_ARGS);
Datum last_period(PG_FUNCTION_ARGS);
Datum next_period(PG_FUNCTION_ARGS);
/* return BOOLEAN */
Datum adjacent_period_period(PG_FUNCTION_ARGS);
Datum contains_period_timestamptz(PG_FUNCTION_ARGS);
Datum contains_period_period(PG_FUNCTION_ARGS);
Datum contained_by_timestamptz_period(PG_FUNCTION_ARGS);
Datum contained_by_period_period(PG_FUNCTION_ARGS);
Datum overlaps_period_period(PG_FUNCTION_ARGS);
Datum overleft_period_period(PG_FUNCTION_ARGS);
Datum overright_period_period(PG_FUNCTION_ARGS);
Datum is_empty_period(PG_FUNCTION_ARGS);
Datum equals_period_period(PG_FUNCTION_ARGS);
Datum nequals_period_period(PG_FUNCTION_ARGS);
Datum before_period_period(PG_FUNCTION_ARGS);
Datum after_period_period(PG_FUNCTION_ARGS);
/* Add operators for <, <=, >=, and > -djg */
Datum lessthan_period_period(PG_FUNCTION_ARGS);
Datum lessthan_period_timestamptz(PG_FUNCTION_ARGS);
Datum lessthan_timestamptz_period(PG_FUNCTION_ARGS);
Datum lessthanequals_period_period(PG_FUNCTION_ARGS);
Datum greaterthan_period_period(PG_FUNCTION_ARGS);
Datum greaterthan_period_timestamptz(PG_FUNCTION_ARGS);
Datum greaterthan_timestamptz_period(PG_FUNCTION_ARGS);
Datum greaterthanequals_period_period(PG_FUNCTION_ARGS);
//merges
/* return period */
Datum empty_period(PG_FUNCTION_ARGS);
Datum minus_period_period(PG_FUNCTION_ARGS);
Datum intersect_period_period(PG_FUNCTION_ARGS);
Datum union_period_period(PG_FUNCTION_ARGS);
/* input/output functions */
Datum period_in(PG_FUNCTION_ARGS);
Datum period_out(PG_FUNCTION_ARGS);
Datum period_oo_timestamptz_timestamptz(PG_FUNCTION_ARGS);
Datum period_oc_timestamptz_timestamptz(PG_FUNCTION_ARGS);
Datum period_co_timestamptz_timestamptz(PG_FUNCTION_ARGS);
Datum period_cc_timestamptz_timestamptz(PG_FUNCTION_ARGS);
Datum period_timestamptz(PG_FUNCTION_ARGS);
/* GiST support functions */
Datum gist_period_consistent(PG_FUNCTION_ARGS);
Datum gist_period_union(PG_FUNCTION_ARGS);
Datum gist_period_compress(PG_FUNCTION_ARGS);
Datum gist_period_decompress(PG_FUNCTION_ARGS);
Datum gist_period_penalty(PG_FUNCTION_ARGS);
Datum gist_period_picksplit(PG_FUNCTION_ARGS);
Datum gist_period_same(PG_FUNCTION_ARGS);
/* btree support functions */
Datum btree_period_compare(PG_FUNCTION_ARGS);
#endif