41 #include <lib/stringinfo.h> 42 #include <catalog/pg_type.h> 81 const Interval *start);
83 const Interval *duration);
Datum period_constructor2(PG_FUNCTION_ARGS)
Construct a period from the two arguments.
Definition: period.c:431
Structure to represent periods.
Definition: timetypes.h:52
Datum period_out(PG_FUNCTION_ARGS)
Output function for periods.
Definition: period.c:361
Datum period_gt(PG_FUNCTION_ARGS)
Returns true if the first period is greater than the second one.
Definition: period.c:828
Internal representation of either bound of a period (not what's on disk)
Definition: timetypes.h:63
void period_deserialize(const Period *p, PeriodBound *lower, PeriodBound *upper)
Deconstruct the period.
Definition: period.c:85
Datum period_in(PG_FUNCTION_ARGS)
Input function for periods.
Definition: period.c:316
int period_cmp_internal(const Period *p1, const Period *p2)
Returns -1, 0, or 1 depending on whether the first period is less than, equal, or greater than the se...
Definition: period.c:713
Datum timestamp_to_period(PG_FUNCTION_ARGS)
Cast the timestamp value as a period.
Definition: period.c:470
Datum period_lower_inc(PG_FUNCTION_ARGS)
Returns true if the lower bound value is inclusive.
Definition: period.c:561
void period_write(const Period *p, StringInfo buf)
Send function for periods (internal function)
Definition: period.c:371
int period_bound_qsort_cmp(const void *a1, const void *a2)
Comparison function for sorting period bounds.
Definition: period.c:159
Datum period_send(PG_FUNCTION_ARGS)
Send function for periods.
Definition: period.c:388
void period_set(Period *p, TimestampTz lower, TimestampTz upper, bool lower_inc, bool upper_inc)
Set the period from the argument values.
Definition: period.c:182
bool period_ne_internal(const Period *p1, const Period *p2)
Returns true if the first period is different from the second one (internal function) ...
Definition: period.c:686
int period_cmp_bounds(const PeriodBound *lower, const PeriodBound *upper)
Compare two period boundary points, returning <0, 0, or >0 according to whether b1 is less than...
Definition: period.c:124
bool period_eq_internal(const Period *p1, const Period *p2)
Returns true if the first period is equal to the second one (internal function)
Definition: period.c:661
Period * period_shift_internal(const Period *p, const Interval *start)
Shift the period by the interval (internal function)
Definition: period.c:582
Datum period_ge(PG_FUNCTION_ARGS)
Returns true if the first period is greater than or equal to the second one.
Definition: period.c:805
Datum period_upper(PG_FUNCTION_ARGS)
Returns the upper bound value.
Definition: period.c:548
bool period_lt_internal(const Period *p1, const Period *p2)
Returns true if the first period is less than the second one (internal function)
Definition: period.c:748
Datum period_duration(PG_FUNCTION_ARGS)
Returns the duration of the period.
Definition: period.c:642
Datum period_lower(PG_FUNCTION_ARGS)
Returns the lower bound value.
Definition: period.c:537
Period * period_make(TimestampTz lower, TimestampTz upper, bool lower_inc, bool upper_inc)
Construct a period from the bounds.
Definition: period.c:170
Period * period_read(StringInfo buf)
Receive function for periods (internal function)
Definition: period.c:401
Datum period_constructor4(PG_FUNCTION_ARGS)
Construct a period from the four arguments.
Definition: period.c:448
void period_shift_tscale(Period *result, const Interval *start, const Interval *duration)
Shift and/or scale the period by the two intervals (internal function)
Definition: period.c:611
Datum period_cmp(PG_FUNCTION_ARGS)
Returns -1, 0, or 1 depending on whether the first period is less than, equal, or greater than the se...
Definition: period.c:734
Datum period_recv(PG_FUNCTION_ARGS)
Receive function for periods.
Definition: period.c:416
Functions for time types based on TimestampTz, that is, TimestampSet, Period, and PeriodSet...
Datum period_ne(PG_FUNCTION_ARGS)
Returns true if the first period is different from the second one.
Definition: period.c:696
bool period_gt_internal(const Period *p1, const Period *p2)
Returns true if the first period is greater than the second one (internal function) ...
Definition: period.c:817
Datum tstzrange_to_period(PG_FUNCTION_ARGS)
Convert the tstzrange value as a period.
Definition: period.c:497
Interval * period_duration_internal(const Period *p)
Returns the duration of the period (internal function)
Definition: period.c:631
void period_expand(Period *p1, const Period *p2)
Expand the first period with the second one.
Definition: period.c:295
Datum period_shift(PG_FUNCTION_ARGS)
Shift the period by the interval.
Definition: period.c:599
bool period_le_internal(const Period *p1, const Period *p2)
Returns true if the first period is less than or equal to the second one (internal function) ...
Definition: period.c:771
Period ** periodarr_normalize(Period **periods, int count, int *newcount)
Normalize an array of periods.
Definition: period.c:235
Period * period_super_union(const Period *p1, const Period *p2)
Returns the smallest period that contains p1 and p2.
Definition: period.c:284
Datum period_upper_inc(PG_FUNCTION_ARGS)
Returns true if the upper bound value is inclusive.
Definition: period.c:572
Datum period_le(PG_FUNCTION_ARGS)
Returns true if the first period is less than or equal to the second one.
Definition: period.c:782
Period * period_copy(const Period *p)
Returns a copy of the period.
Definition: period.c:207
bool upper_inc(RangeType *range)
Returns true if the upper bound of the range value is inclusive.
Definition: rangetypes_ext.c:104
bool period_ge_internal(const Period *p1, const Period *p2)
Returns true if the first period is greater than or equal to the second one (internal function) ...
Definition: period.c:794
bool lower_inc(RangeType *range)
Returns true if the lower bound of the range value is inclusive.
Definition: rangetypes_ext.c:91
Datum period_to_tstzrange(PG_FUNCTION_ARGS)
Convert the period as a tstzrange value.
Definition: period.c:482
char * period_to_string(const Period *p)
Returns the string representation of the period.
Definition: period.c:346
Datum period_lt(PG_FUNCTION_ARGS)
Returns true if the first period is less than the second one.
Definition: period.c:759
Datum period_eq(PG_FUNCTION_ARGS)
Returns true if the first period is equal to the second one.
Definition: period.c:674
float8 period_to_secs(TimestampTz t1, TimestampTz t2)
Returns the number of seconds of the period as a float8 value.
Definition: period.c:218