MobilityDB  1.0
temporal.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * This MobilityDB code is provided under The PostgreSQL License.
4  *
5  * Copyright (c) 2016-2021, Université libre de Bruxelles and MobilityDB
6  * contributors
7  *
8  * MobilityDB includes portions of PostGIS version 3 source code released
9  * under the GNU General Public License (GPLv2 or later).
10  * Copyright (c) 2001-2021, PostGIS contributors
11  *
12  * Permission to use, copy, modify, and distribute this software and its
13  * documentation for any purpose, without fee, and without a written
14  * agreement is hereby granted, provided that the above copyright notice and
15  * this paragraph and the following two paragraphs appear in all copies.
16  *
17  * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
18  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
19  * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
20  * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
21  * OF SUCH DAMAGE.
22  *
23  * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
26  * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
27  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
28  *
29  *****************************************************************************/
30 
36 #ifndef __TEMPORAL_H__
37 #define __TEMPORAL_H__
38 
39 #include <postgres.h>
40 #include <catalog/pg_type.h>
41 #include <lib/stringinfo.h>
42 #include <utils/array.h>
43 #include <utils/rangetypes.h>
44 
45 #include "timetypes.h"
46 #include "tbox.h"
47 #include "point/stbox.h"
48 
49 #if POSTGRESQL_VERSION_NUMBER < 130000
50 #ifndef USE_FLOAT4_BYVAL
51 #error Postgres needs to be configured with USE_FLOAT4_BYVAL
52 #endif
53 #endif
54 
55 #ifndef USE_FLOAT8_BYVAL
56 #error Postgres needs to be configured with USE_FLOAT8_BYVAL
57 #endif
58 
62 #define MOBDB_EPSILON 1.0E-05
63 
66 #define DIST_EPSILON 1.0E-05
67 
69 #define DISCONTINUOUS true
70 #define CONTINUOUS false
71 
73 #define INVERT true
74 #define INVERT_NO false
75 
77 #define REST_AT true
78 #define REST_MINUS false
79 
81 #define UPPER_INC true
82 #define UPPER_EXC false
83 
85 #define EVER true
86 #define ALWAYS false
87 
89 #define GET_MIN true
90 #define GET_MAX false
91 
93 #define CROSSINGS true
94 #define CROSSINGS_NO false
95 
97 #define BBOX_TEST true
98 #define BBOX_TEST_NO false
99 
101 #define MERGE true
102 #define MERGE_NO false
103 
104 #define NORMALIZE true
105 #define NORMALIZE_NO false
106 
107 #define LINEAR true
108 #define STEP false
109 
111 #define WITH_Z true
112 #define NO_Z false
113 
114 /* Determine whether reduce the roundoff errors with the range operations
115  * by taking the bounds instead of the projected value at the timestamp */
116 #define RANGE_ROUNDOFF false
117 
119 typedef enum
120 {
123 } TIntersection;
124 
125 /*****************************************************************************
126  * Concrete subtype of temporal types
127  *****************************************************************************/
128 
132 #define ANYTEMPSUBTYPE 0
133 #define INSTANT 1
134 #define INSTANTSET 2
135 #define SEQUENCE 3
136 #define SEQUENCESET 4
137 
138 #define TYPMOD_GET_SUBTYPE(typmod) ((int16) ((typmod == -1) ? (0) : (typmod & 0x0000000F)))
139 
144 {
145  char *subtypeName;
146  int16 subtype;
147 };
148 
149 #define TEMPSUBTYPE_STRUCT_ARRAY_LEN \
150  (sizeof tempsubtype_struct_array/sizeof(struct tempsubtype_struct))
151 #define TEMPSUBTYPE_MAX_LEN 13
152 
153 /*****************************************************************************
154  * Macros for manipulating the 'flags' element with structure xGTZXLCB, where
155  * x:unused bit, G:Coordinates are geodetic, T:has T coordinate,
156  * Z:has Z coordinate, X:has value or X coordinate,
157  * B:base type passed by value, L: Linear interpolation, C: Continuous base type
158  * Notice that formally speaking the Linear interpolation flag is only needed
159  * for sequence and sequence set subtypes. To facilate the transformation from
160  * one subtype to another, the linear flag for instant and instant set is set
161  * to the value of the continuous subtype flag.
162  *****************************************************************************/
163 
164 /* The following flag is only used for TInstant */
165 #define MOBDB_FLAGS_GET_BYVAL(flags) ((bool) ((flags) & 0x01))
166 #define MOBDB_FLAGS_GET_CONTINUOUS(flags) ((bool) (((flags) & 0x02)>>1))
167 #define MOBDB_FLAGS_GET_LINEAR(flags) ((bool) (((flags) & 0x04)>>2))
168 #define MOBDB_FLAGS_GET_X(flags) ((bool) (((flags) & 0x08)>>3))
169 #define MOBDB_FLAGS_GET_Z(flags) ((bool) (((flags) & 0x10)>>4))
170 #define MOBDB_FLAGS_GET_T(flags) ((bool) (((flags) & 0x20)>>5))
171 #define MOBDB_FLAGS_GET_GEODETIC(flags) ((bool) (((flags) & 0x40)>>6))
172 
173 /* The following flag is only used for TInstant */
174 #define MOBDB_FLAGS_SET_BYVAL(flags, value) \
175  ((flags) = (value) ? ((flags) | 0x01) : ((flags) & 0xFE))
176 #define MOBDB_FLAGS_SET_CONTINUOUS(flags, value) \
177  ((flags) = (value) ? ((flags) | 0x02) : ((flags) & 0xFD))
178 #define MOBDB_FLAGS_SET_LINEAR(flags, value) \
179  ((flags) = (value) ? ((flags) | 0x04) : ((flags) & 0xFB))
180 #define MOBDB_FLAGS_SET_X(flags, value) \
181  ((flags) = (value) ? ((flags) | 0x08) : ((flags) & 0xF7))
182 #define MOBDB_FLAGS_SET_Z(flags, value) \
183  ((flags) = (value) ? ((flags) | 0x10) : ((flags) & 0xEF))
184 #define MOBDB_FLAGS_SET_T(flags, value) \
185  ((flags) = (value) ? ((flags) | 0x20) : ((flags) & 0xDF))
186 #define MOBDB_FLAGS_SET_GEODETIC(flags, value) \
187  ((flags) = (value) ? ((flags) | 0x40) : ((flags) & 0xBF))
188 
189 /*****************************************************************************
190  * Definitions for bucketing and tiling
191  *****************************************************************************/
192 
193 /*
194  * The default origin is Monday 2000-01-03. We don't use PG epoch since it
195  * starts on a saturday. This makes time-buckets by a week more intuitive and
196  * aligns it with date_trunc.
197  */
198 #define JAN_3_2000 (2 * USECS_PER_DAY)
199 #define DEFAULT_TIME_ORIGIN (JAN_3_2000)
200 #define DEFAULT_FLOATRANGE_ORIGIN (0.0)
201 #define DEFAULT_INTRANGE_ORIGIN (0)
202 
203 /*****************************************************************************
204  * Definitions for GiST indexes
205  *****************************************************************************/
206 
207 /* Minimum accepted ratio of split */
208 #define LIMIT_RATIO 0.3
209 
210 /* Convenience macros for NaN-aware comparisons */
211 #define FLOAT8_EQ(a,b) (float8_cmp_internal(a, b) == 0)
212 #define FLOAT8_LT(a,b) (float8_cmp_internal(a, b) < 0)
213 #define FLOAT8_LE(a,b) (float8_cmp_internal(a, b) <= 0)
214 #define FLOAT8_GT(a,b) (float8_cmp_internal(a, b) > 0)
215 #define FLOAT8_GE(a,b) (float8_cmp_internal(a, b) >= 0)
216 #define FLOAT8_MAX(a,b) (FLOAT8_GT(a, b) ? (a) : (b))
217 #define FLOAT8_MIN(a,b) (FLOAT8_LT(a, b) ? (a) : (b))
218 
219 /*****************************************************************************
220  * Additional operator strategy numbers used in the GiST and SP-GiST temporal
221  * opclasses with respect to those defined in the file stratnum.h
222  *****************************************************************************/
223 
224 #define RTOverBeforeStrategyNumber 28 /* for &<# */
225 #define RTBeforeStrategyNumber 29 /* for <<# */
226 #define RTAfterStrategyNumber 30 /* for #>> */
227 #define RTOverAfterStrategyNumber 31 /* for #&> */
228 #define RTOverFrontStrategyNumber 32 /* for &</ */
229 #define RTFrontStrategyNumber 33 /* for <</ */
230 #define RTBackStrategyNumber 34 /* for />> */
231 #define RTOverBackStrategyNumber 35 /* for /&> */
232 
233 /*****************************************************************************
234  * Struct definitions for temporal types
235  *****************************************************************************/
236 
241 typedef struct
242 {
243  int32 vl_len_;
244  int16 subtype;
245  int16 flags;
246  Oid basetypid;
247  /* variable-length data follows, if any */
248 } Temporal;
249 
253 typedef struct
254 {
255  int32 vl_len_;
256  int16 subtype;
257  int16 flags;
258  Oid basetypid;
259  TimestampTz t;
260  /* variable-length data follows */
261 } TInstant;
262 
266 typedef struct
267 {
268  int32 vl_len_;
269  int16 subtype;
270  int16 flags;
271  Oid basetypid;
272  int32 count;
273  size_t offsets[1];
274 } TInstantSet;
275 
279 typedef struct
280 {
281  int32 vl_len_;
282  int16 subtype;
283  int16 flags;
284  Oid basetypid;
285  int32 count;
287  size_t offsets[1];
288 } TSequence;
289 
293 typedef struct
294 {
295  int32 vl_len_;
296  int16 subtype;
297  int16 flags;
298  Oid basetypid;
299  int32 count;
300  int32 totalcount;
301  size_t offsets[1];
302 } TSequenceSet;
303 
307 typedef union bboxunion
308 {
312 } bboxunion;
313 
318 typedef struct
319 {
320  double a;
321  double b;
322 } double2;
323 
328 typedef struct
329 {
330  double a;
331  double b;
332  double c;
333 } double3;
334 
339 typedef struct
340 {
341  double a;
342  double b;
343  double c;
344  double d;
345 } double4;
346 
347 /*****************************************************************************
348  * Miscellaneous
349  *****************************************************************************/
350 
351 /* Definition of qsort comparator for integers */
352 typedef int (*qsort_comparator) (const void *a, const void *b);
353 
354 /* Definition of a variadic function type for temporal lifting */
355 typedef Datum (*varfunc) (Datum, ...);
356 
357 /* Definition of a binary function with two or three Datum arguments */
358 typedef Datum (*datum_func2) (Datum, Datum);
359 typedef Datum (*datum_func3) (Datum, Datum, Datum);
360 
361 /*****************************************************************************
362  * Struct definitions for GisT indexes copied from PostgreSQL
363  *****************************************************************************/
364 
369 typedef struct
370 {
371  /* Index of entry in the initial array */
372  int index;
373  /* Delta between penalties of entry insertion into different groups */
374  double delta;
375 } CommonEntry;
376 
380 typedef struct
381 {
382  double lower,
383  upper;
384 } SplitInterval;
385 
386 /*****************************************************************************
387  * fmgr macros temporal types
388  *****************************************************************************/
389 
390 /* doubleN */
391 
392 #define DatumGetDouble2P(X) ((double2 *) DatumGetPointer(X))
393 #define Double2PGetDatum(X) PointerGetDatum(X)
394 #define DatumGetDouble3P(X) ((double3 *) DatumGetPointer(X))
395 #define Double3PGetDatum(X) PointerGetDatum(X)
396 #define DatumGetDouble4P(X) ((double4 *) DatumGetPointer(X))
397 #define Double4PGetDatum(X) PointerGetDatum(X)
398 
399 /* Temporal types */
400 
401 #define DatumGetTemporal(X) ((Temporal *) PG_DETOAST_DATUM(X))
402 #define DatumGetTInstant(X) ((TInstant *) PG_DETOAST_DATUM(X))
403 #define DatumGetTInstantSet(X) ((TInstantSet *) PG_DETOAST_DATUM(X))
404 #define DatumGetTSequence(X) ((TSequence *) PG_DETOAST_DATUM(X))
405 #define DatumGetTSequenceSet(X) ((TSequenceSet *) PG_DETOAST_DATUM(X))
406 
407 #define PG_GETARG_TEMPORAL(X) ((Temporal *) PG_GETARG_VARLENA_P(X))
408 
409 #define PG_GETARG_ANYDATUM(X) (get_typlen(get_fn_expr_argtype(fcinfo->flinfo, X)) == -1 ? \
410  PointerGetDatum(PG_GETARG_VARLENA_P(X)) : PG_GETARG_DATUM(X))
411 
412 #define DATUM_FREE(value, basetypid) \
413  do { \
414  if (! base_type_byvalue(basetypid)) \
415  pfree(DatumGetPointer(value)); \
416  } while (0)
417 
418 #define DATUM_FREE_IF_COPY(value, basetypid, n) \
419  do { \
420  if (! base_type_byvalue(basetypid) && DatumGetPointer(value) != PG_GETARG_POINTER(n)) \
421  pfree(DatumGetPointer(value)); \
422  } while (0)
423 
424 /*
425  * Define POSTGIS_FREE_IF_COPY_P if POSTGIS is not loaded.
426  * This macro is based on PG_FREE_IF_COPY, except that it accepts two pointers.
427  * See PG_FREE_IF_COPY comment in src/include/fmgr.h in postgres source code
428  * for more details.
429  */
430 #ifndef POSTGIS_FREE_IF_COPY_P
431 #define POSTGIS_FREE_IF_COPY_P(ptrsrc, ptrori) \
432  do { \
433  if ((Pointer) (ptrsrc) != (Pointer) (ptrori)) \
434  pfree(ptrsrc); \
435  } while (0)
436 #endif
437 
438 /*****************************************************************************/
439 
440 /* Initialization function */
441 
442 extern void _PG_init(void);
443 
444 /* Typmod functions */
445 
446 extern const char *tempsubtype_name(int16 subtype);
447 extern bool tempsubtype_from_string(const char *str, int16 *subtype);
448 
449 /* Parameter tests */
450 
451 extern void ensure_valid_tempsubtype(int16 type);
452 extern void ensure_valid_tempsubtype_all(int16 type);
453 extern void ensure_seq_subtypes(int16 subtype);
454 extern void ensure_linear_interpolation(int16 flags);
455 extern void ensure_common_dimension(int16 flags1, int16 flags2);
456 extern void ensure_same_base_type(const Temporal *temp1,
457  const Temporal *temp2);
458 extern void ensure_same_interpolation(const Temporal *temp1,
459  const Temporal *temp2);
460 extern void ensure_increasing_timestamps(const TInstant *inst1,
461  const TInstant *inst2, bool strict);
462 extern void ensure_valid_tinstantarr(const TInstant **instants, int count,
463  bool merge, int16 subtype);
464 extern void ensure_valid_tsequencearr(const TSequence **sequences, int count);
465 
466 extern void ensure_positive_datum(Datum size, Oid type);
467 extern void ensure_valid_duration(const Interval *duration);
468 extern void ensure_non_empty_array(ArrayType *array);
469 
470 /* Miscellaneous functions */
471 
472 extern Temporal *temporal_copy(const Temporal *temp);
473 extern Temporal *pg_getarg_temporal(const Temporal *temp);
474 extern bool intersection_temporal_temporal(const Temporal *temp1,
475  const Temporal *temp2, TIntersection mode,
476  Temporal **inter1, Temporal **inter2);
477 
478 /* Version functions */
479 
480 extern Datum mobilitydb_version(PG_FUNCTION_ARGS);
481 extern Datum mobilitydb_full_version(PG_FUNCTION_ARGS);
482 
483 /* Input/output functions */
484 
485 extern Datum temporal_in(PG_FUNCTION_ARGS);
486 extern Datum temporal_out(PG_FUNCTION_ARGS);
487 extern Datum temporal_send(PG_FUNCTION_ARGS);
488 extern Datum temporal_recv(PG_FUNCTION_ARGS);
489 extern Temporal* temporal_read(StringInfo buf, Oid basetypid);
490 extern void temporal_write(const Temporal* temp, StringInfo buf);
491 
492 /* Constructor functions */
493 
494 extern Datum tinstant_constructor(PG_FUNCTION_ARGS);
495 extern Datum tinstantset_constructor(PG_FUNCTION_ARGS);
496 extern Datum tlinearseq_constructor(PG_FUNCTION_ARGS);
497 extern Datum tstepseq_constructor(PG_FUNCTION_ARGS);
498 extern Datum tsequenceset_constructor(PG_FUNCTION_ARGS);
499 
500 /* Tranformation functions */
501 
502 extern Datum temporal_append_tinstant(PG_FUNCTION_ARGS);
503 extern Datum temporal_merge(PG_FUNCTION_ARGS);
504 extern Datum temporal_merge_array(PG_FUNCTION_ARGS);
505 
506 extern Temporal *temporal_merge_internal(const Temporal *temp1,
507  const Temporal *temp2);
508 extern Temporal *temporal_from_base(const Temporal *temp, Datum value,
509  Oid basetypid, bool linear);
510 
511 /* Cast functions */
512 
513 extern Datum tint_to_tfloat(PG_FUNCTION_ARGS);
514 extern Datum temporal_to_period(PG_FUNCTION_ARGS);
515 
517 
518 /* Accessor functions */
519 
520 extern Datum temporal_subtype(PG_FUNCTION_ARGS);
521 extern Datum temporal_interpolation(PG_FUNCTION_ARGS);
522 extern Datum temporal_mem_size(PG_FUNCTION_ARGS);
523 extern Datum temporal_get_values(PG_FUNCTION_ARGS);
524 extern Datum temporal_get_time(PG_FUNCTION_ARGS);
525 extern Datum tinstant_get_value(PG_FUNCTION_ARGS);
526 extern Datum tnumber_to_tbox(PG_FUNCTION_ARGS);
527 extern Datum tnumber_value_range(PG_FUNCTION_ARGS);
528 extern Datum temporal_start_value(PG_FUNCTION_ARGS);
529 extern Datum temporal_end_value(PG_FUNCTION_ARGS);
530 extern Datum temporal_min_value(PG_FUNCTION_ARGS);
531 extern Datum temporal_max_value(PG_FUNCTION_ARGS);
532 extern Datum temporal_num_instants(PG_FUNCTION_ARGS);
533 extern Datum temporal_start_instant(PG_FUNCTION_ARGS);
534 extern Datum temporal_end_instant(PG_FUNCTION_ARGS);
535 extern Datum temporal_instant_n(PG_FUNCTION_ARGS);
536 extern Datum temporal_instants(PG_FUNCTION_ARGS);
537 extern Datum temporal_num_timestamps(PG_FUNCTION_ARGS);
538 extern Datum temporal_start_timestamp(PG_FUNCTION_ARGS);
539 extern Datum temporal_end_timestamp(PG_FUNCTION_ARGS);
540 extern Datum temporal_timestamp_n(PG_FUNCTION_ARGS);
541 extern Datum temporal_timestamps(PG_FUNCTION_ARGS);
542 extern Datum temporal_shift(PG_FUNCTION_ARGS);
543 
544 extern ArrayType *temporal_timestamps_internal(const Temporal *temp);
545 extern const TInstant **temporal_instants_internal(const Temporal *temp,
546  int *count);
547 
548 extern const TInstant *tinstarr_inst_n(const Temporal *temp, int n);
549 extern PeriodSet *temporal_get_time_internal(const Temporal *temp);
550 extern Datum tfloat_ranges(const Temporal *temp);
551 extern const TInstant *temporal_min_instant(const Temporal *temp);
552 extern Datum temporal_min_value_internal(const Temporal *temp);
553 extern const TInstant *temporal_end_instant_internal(const Temporal *temp);
554 extern TimestampTz temporal_start_timestamp_internal(const Temporal *temp);
555 extern RangeType *tnumber_value_range_internal(const Temporal *temp);
556 
557 /* Ever/always equal operators */
558 
559 extern Datum temporal_ever_eq(PG_FUNCTION_ARGS);
560 extern Datum temporal_ever_ne(PG_FUNCTION_ARGS);
561 extern Datum temporal_ever_lt(PG_FUNCTION_ARGS);
562 extern Datum temporal_ever_le(PG_FUNCTION_ARGS);
563 extern Datum temporal_ever_gt(PG_FUNCTION_ARGS);
564 extern Datum temporal_ever_ge(PG_FUNCTION_ARGS);
565 
566 extern Datum temporal_always_eq(PG_FUNCTION_ARGS);
567 extern Datum temporal_always_ne(PG_FUNCTION_ARGS);
568 extern Datum temporal_always_lt(PG_FUNCTION_ARGS);
569 extern Datum temporal_always_le(PG_FUNCTION_ARGS);
570 extern Datum temporal_always_gt(PG_FUNCTION_ARGS);
571 extern Datum temporal_always_ge(PG_FUNCTION_ARGS);
572 
573 extern bool temporal_bbox_ev_al_eq(const Temporal *temp, Datum value,
574  bool ever);
575 extern bool temporal_bbox_ev_al_lt_le(const Temporal *temp, Datum value,
576  bool ever);
577 extern bool temporal_ever_eq_internal(const Temporal *temp, Datum value);
578 
579 /* Restriction functions */
580 
581 extern Datum temporal_at_value(PG_FUNCTION_ARGS);
582 extern Datum temporal_minus_value(PG_FUNCTION_ARGS);
583 extern Datum temporal_at_values(PG_FUNCTION_ARGS);
584 extern Datum tnumber_at_range(PG_FUNCTION_ARGS);
585 extern Datum tnumber_minus_range(PG_FUNCTION_ARGS);
586 extern Datum tnumber_at_ranges(PG_FUNCTION_ARGS);
587 extern Datum tnumber_minus_ranges(PG_FUNCTION_ARGS);
588 extern Datum temporal_at_min(PG_FUNCTION_ARGS);
589 extern Datum temporal_minus_min(PG_FUNCTION_ARGS);
590 extern Datum temporal_at_max(PG_FUNCTION_ARGS);
591 extern Datum temporal_minus_max(PG_FUNCTION_ARGS);
592 extern Datum temporal_at_timestamp(PG_FUNCTION_ARGS);
593 extern Datum temporal_minus_timestamp(PG_FUNCTION_ARGS);
594 extern Datum temporal_value_at_timestamp(PG_FUNCTION_ARGS);
595 extern Datum temporal_at_timestampset(PG_FUNCTION_ARGS);
596 extern Datum temporal_minus_timestampset(PG_FUNCTION_ARGS);
597 extern Datum temporal_at_period(PG_FUNCTION_ARGS);
598 extern Datum temporal_minus_period(PG_FUNCTION_ARGS);
599 extern Datum temporal_at_periodset(PG_FUNCTION_ARGS);
600 extern Datum temporal_minus_periodset(PG_FUNCTION_ARGS);
601 extern Datum temporal_intersects_timestamp(PG_FUNCTION_ARGS);
602 extern Datum temporal_intersects_timestampset(PG_FUNCTION_ARGS);
603 extern Datum temporal_intersects_period(PG_FUNCTION_ARGS);
604 extern Datum temporal_intersects_periodset(PG_FUNCTION_ARGS);
605 
606 extern bool temporal_value_at_timestamp_inc(const Temporal *temp,
607  TimestampTz t, Datum *value);
608 
609 extern bool temporal_bbox_restrict_value(const Temporal *temp, Datum value);
610 extern Datum *temporal_bbox_restrict_values(const Temporal *temp,
611  const Datum *values, int count, int *newcount);
612 extern RangeType **tnumber_bbox_restrict_ranges(const Temporal *temp,
613  RangeType **ranges, int count, int *newcount);
615  RangeType *range, bool atfunc);
616 
618  TimestampTz t, bool atfunc);
619 extern Temporal *temporal_at_period_internal(const Temporal *temp,
620  const Period *ps);
622  const Period *ps);
624  const PeriodSet *ps, bool atfunc);
625 
626 extern void temporal_period(Period *p, const Temporal *temp);
627 extern char *temporal_to_string(const Temporal *temp,
628  char *(*value_out)(Oid, Datum));
629 extern void *temporal_bbox_ptr(const Temporal *temp);
630 extern void temporal_bbox(void *box, const Temporal *temp);
631 
632 /* Comparison functions */
633 
634 extern Datum temporal_lt(PG_FUNCTION_ARGS);
635 extern Datum temporal_le(PG_FUNCTION_ARGS);
636 extern Datum temporal_eq(PG_FUNCTION_ARGS);
637 extern Datum temporal_ge(PG_FUNCTION_ARGS);
638 extern Datum temporal_gt(PG_FUNCTION_ARGS);
639 extern Datum temporal_cmp(PG_FUNCTION_ARGS);
640 extern Datum temporal_hash(PG_FUNCTION_ARGS);
641 
642 extern uint32 temporal_hash_internal(const Temporal *temp);
643 
644 /*****************************************************************************/
645 
646 #endif
Datum tinstantset_constructor(PG_FUNCTION_ARGS)
Construct a temporal instant set value from the array of temporal instant values. ...
Definition: temporal.c:834
int32 count
number of TInstant elements
Definition: temporal.h:272
Datum temporal_ever_eq(PG_FUNCTION_ARGS)
Returns true if the temporal value is ever equal to the base value.
Definition: temporal.c:2845
Datum temporal_get_time(PG_FUNCTION_ARGS)
Returns the time on which the temporal value is defined as a period set.
Definition: temporal.c:1748
Datum temporal_at_periodset(PG_FUNCTION_ARGS)
Restricts the temporal value to the period set.
Definition: temporal.c:3860
const TInstant ** temporal_instants_internal(const Temporal *temp, int *count)
Returns the instants of the temporal value as a C array.
Definition: temporal.c:2345
int32 vl_len_
varlena header (do not touch directly!)
Definition: temporal.h:295
double a
Definition: temporal.h:320
Datum temporal_timestamps(PG_FUNCTION_ARGS)
Returns the distinct timestamps of the temporal value as an array.
Definition: temporal.c:2527
Structure to represent periods.
Definition: timetypes.h:52
Datum mobilitydb_version(PG_FUNCTION_ARGS)
Version of the MobilityDB extension.
Definition: temporal.c:568
void ensure_valid_duration(const Interval *duration)
Ensures that the interval is a positive and absolute duration.
Definition: temporal.c:416
Datum temporal_ever_ge(PG_FUNCTION_ARGS)
Returns true if the temporal value is ever greater than or equal to the base value.
Definition: temporal.c:2948
RangeType ** tnumber_bbox_restrict_ranges(const Temporal *temp, RangeType **ranges, int count, int *newcount)
Returns the array of ranges of base values that overlap with the bounding box of the temporal value...
Definition: temporal.c:3109
Datum temporal_intersects_period(PG_FUNCTION_ARGS)
Returns true if the temporal value intersects the period.
Definition: temporal.c:4058
void ensure_valid_tsequencearr(const TSequence **sequences, int count)
Ensures that all temporal instant values of the array have increasing timestamp, and if they are temp...
Definition: temporal.c:369
Datum * temporal_bbox_restrict_values(const Temporal *temp, const Datum *values, int count, int *newcount)
Returns the array of base values that are contained in the bounding box of the temporal value...
Definition: temporal.c:3017
const TInstant * temporal_min_instant(const Temporal *temp)
Returns a pointer to the instant with minimum base value of the temporal value.
Definition: temporal.c:1943
Datum temporal_at_min(PG_FUNCTION_ARGS)
Restricts the temporal value to the minimum base value.
Definition: temporal.c:3547
Datum temporal_intersects_timestamp(PG_FUNCTION_ARGS)
Returns true if the temporal value intersects the timestamp.
Definition: temporal.c:4011
Datum temporal_end_instant(PG_FUNCTION_ARGS)
Returns the end instant of the temporal value.
Definition: temporal.c:2275
RangeType * tnumber_value_range_internal(const Temporal *temp)
Returns the value range of the temporal integer value (internal function)
Definition: temporal.c:1833
Datum temporal_le(PG_FUNCTION_ARGS)
Returns true if the first temporal value is less than or equal to the second one. ...
Definition: temporal.c:4419
Definition: temporal.h:121
TIntersection
Enumeration for the intersection/synchronization functions.
Definition: temporal.h:119
Datum temporal_mem_size(PG_FUNCTION_ARGS)
Returns the size in bytes of the temporal value.
Definition: temporal.c:1622
void ensure_seq_subtypes(int16 subtype)
Ensures that the temporal type is a sequence (set)
Definition: temporal.c:235
Datum temporal_at_values(PG_FUNCTION_ARGS)
Restricts the temporal value to the array of base values.
Definition: temporal.c:3308
int16 subtype
subtype
Definition: temporal.h:269
Datum tnumber_minus_range(PG_FUNCTION_ARGS)
Restricts the temporal value to the complement of the range of base values.
Definition: temporal.c:3394
double c
Definition: temporal.h:332
Datum temporal_shift(PG_FUNCTION_ARGS)
Shift the time span of the temporal value by the interval.
Definition: temporal.c:2574
Structure to represent a projection of bounding box to an axis.
Definition: temporal.h:380
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: temporal.h:241
uint32 temporal_hash_internal(const Temporal *temp)
Returns the hash value of the temporal value (dispatch function)
Definition: temporal.c:4478
Datum temporal_gt(PG_FUNCTION_ARGS)
Returns true if the first temporal value is greater than the second one.
Definition: temporal.c:4456
Period period
time span (24 bytes)
Definition: temporal.h:286
void ensure_same_interpolation(const Temporal *temp1, const Temporal *temp2)
Ensures that the two temporal values have the same interpolation.
Definition: temporal.c:302
void ensure_non_empty_array(ArrayType *array)
Ensures that the array is not empty.
Definition: temporal.c:441
bool temporal_bbox_ev_al_lt_le(const Temporal *temp, Datum value, bool ever)
Returns true if the bounding box of the temporal value is ever/always less than or equal to the base ...
Definition: temporal.c:2667
void ensure_linear_interpolation(int16 flags)
Ensure that the temporal value has linear interpolation.
Definition: temporal.c:265
int16 flags
flags
Definition: temporal.h:283
int32 vl_len_
varlena header (do not touch directly!)
Definition: temporal.h:255
bool temporal_bbox_restrict_value(const Temporal *temp, Datum value)
Returns true if the bounding box of the temporal value contains the base value.
Definition: temporal.c:2972
TimestampTz t
timestamp (8 bytes)
Definition: temporal.h:259
Temporal * temporal_minus_period_internal(const Temporal *temp, const Period *ps)
int32 count
number of TInstant elements
Definition: temporal.h:285
Structure to represent spatiotemporal boxes.
Definition: stbox.h:51
Datum temporal_merge(PG_FUNCTION_ARGS)
Merge the two temporal values.
Definition: temporal.c:1102
Datum temporal_interpolation(PG_FUNCTION_ARGS)
Returns the string representation of the temporal interpolation.
Definition: temporal.c:1597
Datum temporal_start_instant(PG_FUNCTION_ARGS)
Returns the start instant of the temporal value.
Definition: temporal.c:2225
Datum temporal_num_instants(PG_FUNCTION_ARGS)
Returns the number of distinct instants of the temporal value.
Definition: temporal.c:2203
Datum temporal_hash(PG_FUNCTION_ARGS)
Returns the hash value of the temporal value.
Definition: temporal.c:4498
int32 totalcount
total number of TInstant elements in all TSequence elements
Definition: temporal.h:300
Datum temporal_intersects_timestampset(PG_FUNCTION_ARGS)
Returns true if the temporal value intersects the timestamp set.
Definition: temporal.c:4034
double a
Definition: temporal.h:330
int16 subtype
subtype
Definition: temporal.h:282
double b
Definition: temporal.h:321
Structure to represent the temporal subtype array.
Definition: temporal.h:143
Oid basetypid
base type&#39;s OID (4 bytes)
Definition: temporal.h:246
Datum temporal_always_gt(PG_FUNCTION_ARGS)
Returns true if the temporal value is always greater than the base value.
Definition: temporal.c:2937
Datum temporal_append_tinstant(PG_FUNCTION_ARGS)
Append an instant to the end of a temporal value.
Definition: temporal.c:937
bool intersection_temporal_temporal(const Temporal *temp1, const Temporal *temp2, TIntersection mode, Temporal **inter1, Temporal **inter2)
Temporally intersect the two temporal values.
Definition: temporal.c:473
Temporal * temporal_from_base(const Temporal *temp, Datum value, Oid basetypid, bool linear)
Transform a temporal value into a constant value with the same time frame (internal function) ...
Definition: temporal.c:1233
Temporal * temporal_merge_internal(const Temporal *temp1, const Temporal *temp2)
Definition: temporal.c:1054
Temporal * pg_getarg_temporal(const Temporal *temp)
Structure to represent values of the internal type for computing aggregates for temporal number types...
Definition: temporal.h:318
Datum temporal_recv(PG_FUNCTION_ARGS)
Generic receive function for temporal types.
Definition: temporal.c:726
int16 flags
flags
Definition: temporal.h:297
Temporal * temporal_at_period_internal(const Temporal *temp, const Period *ps)
Definition: temporal.c:3774
bool tempsubtype_from_string(const char *str, int16 *subtype)
Returns the enum value corresponding to the string representation of the concrete subtype of the temp...
Definition: temporal.c:132
Datum temporal_start_value(PG_FUNCTION_ARGS)
Returns the start base value of the temporal value.
Definition: temporal.c:1884
double upper
Definition: temporal.h:382
Oid basetypid
base type&#39;s OID (4 bytes)
Definition: temporal.h:271
Datum mobilitydb_full_version(PG_FUNCTION_ARGS)
Versions of the MobilityDB extension and its dependencies.
Definition: temporal.c:580
int16 flags
flags
Definition: temporal.h:257
int32 vl_len_
varlena header (do not touch directly!)
Definition: temporal.h:281
Datum tnumber_at_ranges(PG_FUNCTION_ARGS)
Restricts the temporal value to the array of ranges of base values.
Definition: temporal.c:3487
STBOX g
Definition: temporal.h:311
Datum temporal_max_value(PG_FUNCTION_ARGS)
Returns the maximum base value of the temporal value.
Definition: temporal.c:1999
Datum temporal_at_value(PG_FUNCTION_ARGS)
Restricts the temporal value to the base value.
Definition: temporal.c:3205
double a
Definition: temporal.h:341
Datum tsequenceset_constructor(PG_FUNCTION_ARGS)
Construct a temporal sequence set value from the array of temporal sequence values.
Definition: temporal.c:898
Datum temporal_intersects_periodset(PG_FUNCTION_ARGS)
Returns true if the temporal value intersects the period set.
Definition: temporal.c:4081
bool temporal_value_at_timestamp_inc(const Temporal *temp, TimestampTz t, Datum *value)
Returns the base value of the temporal value at the timestamp when the timestamp may be at an exclusi...
Definition: temporal.c:3651
Datum temporal_send(PG_FUNCTION_ARGS)
Definition: temporal.c:687
void * temporal_bbox_ptr(const Temporal *temp)
Returns a pointer to the precomputed bounding box of the temporal value.
Definition: temporal.c:1780
Structure to represent period sets.
Definition: timetypes.h:84
Period p
Definition: temporal.h:309
Temporal * temporal_restrict_periodset_internal(const Temporal *temp, const PeriodSet *ps, bool atfunc)
Restricts the temporal value to the (complement of the) period set (dispatch function) ...
Definition: temporal.c:3819
Datum temporal_end_timestamp(PG_FUNCTION_ARGS)
Returns the end timestamp of the temporal value.
Definition: temporal.c:2420
Datum temporal_at_timestampset(PG_FUNCTION_ARGS)
Restricts the temporal value to the timestamp set.
Definition: temporal.c:3730
Datum tnumber_at_range(PG_FUNCTION_ARGS)
Restricts the temporal value to the range of base values.
Definition: temporal.c:3384
int32 vl_len_
varlena header (do not touch directly!)
Definition: temporal.h:268
Datum tstepseq_constructor(PG_FUNCTION_ARGS)
Construct a temporal sequence value with stepwise interpolation from the array of temporal instant va...
Definition: temporal.c:876
Oid basetypid
base type&#39;s OID (4 bytes)
Definition: temporal.h:298
Datum tnumber_value_range(PG_FUNCTION_ARGS)
Returns the value range of the temporal integer value.
Definition: temporal.c:1867
Datum temporal_ever_gt(PG_FUNCTION_ARGS)
Returns true if the temporal value is ever greater than the base value.
Definition: temporal.c:2927
Datum temporal_always_le(PG_FUNCTION_ARGS)
Returns true if the temporal value is always less than or equal to the base value.
Definition: temporal.c:2917
Structure to represent temporal boxes.
Definition: tbox.h:53
Datum temporal_num_timestamps(PG_FUNCTION_ARGS)
Returns the number of distinct timestamps of the temporal value.
Definition: temporal.c:2442
Datum temporal_subtype(PG_FUNCTION_ARGS)
Returns the string representation of the temporal type.
Definition: temporal.c:1575
void _PG_init(void)
Initialize the extension.
Definition: temporal.c:81
ArrayType * temporal_timestamps_internal(const Temporal *temp)
Returns the distinct timestamps of the temporal value as an array.
Definition: temporal.c:2507
Datum temporal_instants(PG_FUNCTION_ARGS)
Returns the distinct instants of the temporal value as an array.
Definition: temporal.c:2365
Structure to represent all types of bounding boxes.
Definition: temporal.h:307
Datum temporal_at_max(PG_FUNCTION_ARGS)
Restricts the temporal value to the maximum base value.
Definition: temporal.c:3567
int16 flags
flags
Definition: temporal.h:245
int16 flags
flags
Definition: temporal.h:270
Datum temporal_cmp(PG_FUNCTION_ARGS)
Returns -1, 0, or 1 depending on whether the first temporal value is less than, equal, or greater than the second temporal value.
Definition: temporal.c:4237
Datum temporal_lt(PG_FUNCTION_ARGS)
Returns true if the first temporal value is less than the second one.
Definition: temporal.c:4400
Datum temporal_minus_value(PG_FUNCTION_ARGS)
Restricts the temporal value to the complement of the base value.
Definition: temporal.c:3215
Datum temporal_ever_le(PG_FUNCTION_ARGS)
Returns true if the temporal value is ever less than or equal to the base value.
Definition: temporal.c:2907
Datum temporal_get_values(PG_FUNCTION_ARGS)
Returns the base values of the temporal value as an array.
Definition: temporal.c:1663
Datum temporal_out(PG_FUNCTION_ARGS)
Generic output function for temporal types.
Definition: temporal.c:651
Datum temporal_minus_period(PG_FUNCTION_ARGS)
Restricts the temporal value to the complement of the period.
Definition: temporal.c:3807
Functions for time types based on TimestampTz, that is, TimestampSet, Period, and PeriodSet...
Temporal * tnumber_restrict_range_internal(const Temporal *temp, RangeType *range, bool atfunc)
Restricts the temporal value to the (complement of the) range of base values (dispatch function) ...
Definition: temporal.c:3330
TBOX b
Definition: temporal.h:310
Datum temporal_value_at_timestamp(PG_FUNCTION_ARGS)
Returns the base value of the temporal value at the timestamp.
Definition: temporal.c:3673
TimestampTz temporal_start_timestamp_internal(const Temporal *temp)
Returns the start timestamp of the temporal value (dispatch function)
Definition: temporal.c:2387
Datum tinstant_constructor(PG_FUNCTION_ARGS)
Construct a temporal instant value from the arguments.
Definition: temporal.c:819
Datum temporal_ever_lt(PG_FUNCTION_ARGS)
Returns true if the temporal value is ever less than the base value.
Definition: temporal.c:2887
Structure to represent temporal values of sequence set subtype.
Definition: temporal.h:293
int(* qsort_comparator)(const void *a, const void *b)
Definition: temporal.h:352
Datum temporal_min_value_internal(const Temporal *temp)
Returns the minimum base value of the temporal value (dispatch function)
Definition: temporal.c:1963
Functions for temporal bounding boxes.
Datum temporal_merge_array(PG_FUNCTION_ARGS)
Merge the array of temporal values.
Definition: temporal.c:1163
Datum temporal_minus_max(PG_FUNCTION_ARGS)
Restricts the temporal value to the complement of the maximum base value.
Definition: temporal.c:3577
Structure to represent information about an entry that can be placed to either group without affectin...
Definition: temporal.h:369
void ensure_positive_datum(Datum size, Oid type)
Ensures that the number is positive.
Definition: temporal.c:394
Oid basetypid
base type&#39;s OID (4 bytes)
Definition: temporal.h:284
Datum temporal_always_lt(PG_FUNCTION_ARGS)
Returns true if the temporal value is always less than the base value.
Definition: temporal.c:2897
union bboxunion bboxunion
Structure to represent all types of bounding boxes.
Datum temporal_min_value(PG_FUNCTION_ARGS)
Returns the minimum base value of the temporal value.
Definition: temporal.c:1986
Datum tint_to_tfloat(PG_FUNCTION_ARGS)
Cast the temporal integer value as a temporal float value.
Definition: temporal.c:1373
Oid basetypid
base type&#39;s OID (4 bytes)
Definition: temporal.h:258
Structure to represent temporal values of instant set subtype.
Definition: temporal.h:266
bool temporal_ever_eq_internal(const Temporal *temp, Datum value)
Returns true if the temporal value is ever equal to the base value (internal function) ...
Definition: temporal.c:2690
Datum tnumber_minus_ranges(PG_FUNCTION_ARGS)
Restricts the temporal value to the complement of the array of ranges of base values.
Definition: temporal.c:3498
double c
Definition: temporal.h:343
Datum temporal_minus_periodset(PG_FUNCTION_ARGS)
Restricts the temporal value to the complement of the period set.
Definition: temporal.c:3870
Datum tinstant_get_value(PG_FUNCTION_ARGS)
Returns the base value of the temporal instant value.
Definition: temporal.c:1710
void ensure_common_dimension(int16 flags1, int16 flags2)
Ensure that the temporal values have at least one common dimension.
Definition: temporal.c:277
int32 count
number of TSequence elements
Definition: temporal.h:299
Datum tfloat_ranges(const Temporal *temp)
Returns the base values of the temporal float value as an array of ranges (dispatch function) ...
Definition: temporal.c:1676
Structure to represent values of the internal type for computing aggregates for 2D temporal point typ...
Definition: temporal.h:328
Datum temporal_minus_min(PG_FUNCTION_ARGS)
Restricts the temporal value to the complement of the minimum base value.
Definition: temporal.c:3557
bool temporal_bbox_ev_al_eq(const Temporal *temp, Datum value, bool ever)
Returns true if the bounding box of the temporal value is ever equal to the base value.
Definition: temporal.c:2625
Datum temporal_timestamp_n(PG_FUNCTION_ARGS)
Returns the n-th distinct timestamp of the temporal value.
Definition: temporal.c:2464
Datum(* datum_func2)(Datum, Datum)
Definition: temporal.h:358
int16 subtype
subtype
Definition: temporal.h:296
int index
Definition: temporal.h:372
PeriodSet * temporal_get_time_internal(const Temporal *temp)
Returns the time on which the temporal value is defined as a period set (dispatch function) ...
Definition: temporal.c:1728
Datum temporal_always_ne(PG_FUNCTION_ARGS)
Returns true if the temporal value is always different from the base value.
Definition: temporal.c:2875
void temporal_bbox(void *box, const Temporal *temp)
Set the first argument to the bounding box of the temporal value.
Definition: temporal.c:1800
double b
Definition: temporal.h:342
void ensure_increasing_timestamps(const TInstant *inst1, const TInstant *inst2, bool strict)
Ensures that the timestamp of the first temporal instant is smaller (or equal if the merge parameter ...
Definition: temporal.c:317
double delta
Definition: temporal.h:374
Temporal * temporal_copy(const Temporal *temp)
Returns a copy of the temporal value.
Definition: temporal.c:457
void temporal_period(Period *p, const Temporal *temp)
Returns the bounding period on which the temporal value is defined (dispatch function) ...
Definition: temporal.c:1419
Datum temporal_always_ge(PG_FUNCTION_ARGS)
Returns true if the temporal value is always greater than or equal to the base value.
Definition: temporal.c:2959
void ensure_same_base_type(const Temporal *temp1, const Temporal *temp2)
Ensures that the two temporal values have the same base type.
Definition: temporal.c:290
const TInstant * tinstarr_inst_n(const Temporal *temp, int n)
Returns the n-th instant of the temporal instant set or a temporal sequence value.
Definition: temporal.c:2288
int16 subtype
subtype
Definition: temporal.h:146
void temporal_write(const Temporal *temp, StringInfo buf)
Write the binary representation of the temporal value into the buffer (dispatch function) ...
Definition: temporal.c:667
void ensure_valid_tempsubtype(int16 type)
Ensures that the temporal type is valid.
Definition: temporal.c:208
void ensure_valid_tinstantarr(const TInstant **instants, int count, bool merge, int16 subtype)
Ensures that all temporal instant values of the array have increasing timestamp (or may be equal if t...
Definition: temporal.c:349
int16 subtype
subtype
Definition: temporal.h:256
Temporal * temporal_read(StringInfo buf, Oid basetypid)
Returns a new temporal value from its binary representation read from the buffer (dispatch function) ...
Definition: temporal.c:705
Datum temporal_always_eq(PG_FUNCTION_ARGS)
Returns true if the temporal value is always equal to the base value.
Definition: temporal.c:2855
Datum temporal_minus_timestampset(PG_FUNCTION_ARGS)
Restricts the temporal value to the complement of the timestamp set.
Definition: temporal.c:3740
Datum temporal_at_timestamp(PG_FUNCTION_ARGS)
Restricts the temporal value to the timestamp.
Definition: temporal.c:3629
Datum temporal_ge(PG_FUNCTION_ARGS)
Returns true if the first temporal value is greater than or equal to the second one.
Definition: temporal.c:4438
char * temporal_to_string(const Temporal *temp, char *(*value_out)(Oid, Datum))
Returns the string representation of the temporal value (dispatch function)
Definition: temporal.c:631
int16 subtype
subtype
Definition: temporal.h:244
char * subtypeName
string representing the temporal type
Definition: temporal.h:145
double b
Definition: temporal.h:331
Datum tlinearseq_constructor(PG_FUNCTION_ARGS)
Construct a temporal sequence value with linear or stepwise interpolation from the array of temporal ...
Definition: temporal.c:887
Temporal * temporal_restrict_timestamp_internal(const Temporal *temp, TimestampTz t, bool atfunc)
Restricts the temporal value to the timestamp (dispatch function)
Definition: temporal.c:3589
Functions for spatiotemporal bounding boxes.
Datum temporal_minus_timestamp(PG_FUNCTION_ARGS)
Restricts the temporal value to the complement of the timestamp.
Definition: temporal.c:3639
void ensure_valid_tempsubtype_all(int16 type)
Ensures that the temporal type is valid.
Definition: temporal.c:222
Datum temporal_in(PG_FUNCTION_ARGS)
Generic input function for temporal types.
Definition: temporal.c:608
Datum temporal_ever_ne(PG_FUNCTION_ARGS)
Returns true if the temporal value is ever different from the base value.
Definition: temporal.c:2865
Structure to represent values of the internal type for computing aggregates for 3D temporal point typ...
Definition: temporal.h:339
Definition: temporal.h:122
Datum temporal_instant_n(PG_FUNCTION_ARGS)
Returns the n-th instant of the temporal value.
Definition: temporal.c:2302
Datum tnumber_to_tbox(PG_FUNCTION_ARGS)
Returns the bounding box of the temporal value.
Definition: temporal.c:1819
double d
Definition: temporal.h:344
Datum temporal_end_value(PG_FUNCTION_ARGS)
Returns the end base value of the temporal value.
Definition: temporal.c:1909
Structure to represent temporal values of sequence subtype.
Definition: temporal.h:279
int32 vl_len_
varlena header (do not touch directly!)
Definition: temporal.h:243
Temporal * tint_to_tfloat_internal(Temporal *temp)
Cast the temporal integer value as a temporal float value (dispatch function)
Definition: temporal.c:1354
const TInstant * temporal_end_instant_internal(const Temporal *temp)
Returns the end instant of the temporal value (internal function).
Definition: temporal.c:2251
const char * tempsubtype_name(int16 subtype)
Returns the string representation of the subtype of the temporal type corresponding to the enum value...
Definition: temporal.c:122
Datum temporal_start_timestamp(PG_FUNCTION_ARGS)
Returns the start timestamp of the temporal value.
Definition: temporal.c:2407
Datum(* datum_func3)(Datum, Datum, Datum)
Definition: temporal.h:359
Datum temporal_at_period(PG_FUNCTION_ARGS)
Restricts the temporal value to the period.
Definition: temporal.c:3796
Datum(* varfunc)(Datum,...)
Definition: temporal.h:355
Datum temporal_to_period(PG_FUNCTION_ARGS)
Returns the bounding period on which the temporal value is defined.
Definition: temporal.c:1438
Datum temporal_eq(PG_FUNCTION_ARGS)
Returns true if the two temporal values are equal.
Definition: temporal.c:4358
Structure to represent temporal values of instant subtype.
Definition: temporal.h:253