MobilityDB 1.1
pg_types.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * This MobilityDB code is provided under The PostgreSQL License.
4 * Copyright (c) 2016-2023, Université libre de Bruxelles and MobilityDB
5 * contributors
6 *
7 * MobilityDB includes portions of PostGIS version 3 source code released
8 * under the GNU General Public License (GPLv2 or later).
9 * Copyright (c) 2001-2023, PostGIS contributors
10 *
11 * Permission to use, copy, modify, and distribute this software and its
12 * documentation for any purpose, without fee, and without a written
13 * agreement is hereby granted, provided that the above copyright notice and
14 * this paragraph and the following two paragraphs appear in all copies.
15 *
16 * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
17 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
18 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
19 * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
20 * OF SUCH DAMAGE.
21 *
22 * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
25 * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
27 *
28 *****************************************************************************/
29
36#ifndef PG_CALL_H
37#define PG_CALL_H
38
39/* PostgreSQL */
40#include <postgres.h>
41#include <utils/timestamp.h>
42
43/* Functions adadpted from bool.c */
44
45extern bool bool_in(const char *in_str);
46extern char *bool_out(bool b);
47
48/* Functions adapted from int.c */
49
50extern int32 int4_in(const char *str);
51extern char *int4_out(int32 val);
52
53/* Functions adapted from int8.c */
54
55extern int64 int8_in(const char *str);
56extern char *int8_out(int64 val);
57
58/* Functions adapted from float.c */
59
60extern float8 float8_in(const char *num, const char *type_name,
61 const char *orig_string);
62extern char *float8_out(double num, int maxdd);
63extern float8 pg_dsin(float8 arg1);
64extern float8 pg_dcos(float8 arg1);
65extern float8 pg_datan(float8 arg1);
66extern float8 pg_datan2(float8 arg1, float8 arg2);
67
68/* Functions adadpted from timestamp.c */
69
70extern TimestampTz pg_timestamptz_in(const char *str, int32 typmod);
71extern char *pg_timestamptz_out(TimestampTz dt);
72
73extern Interval *pg_interval_pl(const Interval *span1, const Interval *span2);
75 const Interval *span);
77 const Interval *span);
80extern int pg_interval_cmp(const Interval *interval1,
81 const Interval *interval2);
82
83/* Functions adapted from hashfn.h and hashfn.c */
84
86extern uint32 pg_hashint8(int64 val);
87extern uint32 pg_hashfloat8(float8 key);
89extern uint64 pg_hashint8extended(int64 val, uint64 seed);
91extern uint32 pg_hashtext(text *key);
92extern uint64 pg_hashtextextended(text *key, uint64 seed);
93
94/*****************************************************************************/
95
96#endif /* PG_CALL_H */
double float8
Definition: c.h:570
TimestampTz pg_timestamp_mi_interval(TimestampTz timestamp, const Interval *span)
Add an interval to a timestamp data type.
Definition: pg_types.c:1084
TimestampTz pg_timestamp_pl_interval(TimestampTz timestamp, const Interval *span)
Add an interval to a timestamp data type.
Definition: pg_types.c:1012
TimestampTz pg_timestamptz_in(const char *str, int32 typmod)
Convert a string to a timestamp with time zone.
Definition: pg_types.c:540
Interval * pg_interval_pl(const Interval *span1, const Interval *span2)
Add an interval to a timestamp data type.
Definition: pg_types.c:975
bool bool_in(const char *in_str)
MobilityDB functions pg_func(...) corresponding to external PostgreSQL functions func(PG_FUNCTION_ARG...
Definition: basetype_inout.c:151
char * pg_timestamptz_out(TimestampTz dt)
Convert a timestamp with timezone to a string.
Definition: pg_types.c:589
char * bool_out(bool b)
Convert 1 or 0 to "t" or "f".
Definition: basetype_inout.c:183
int pg_interval_cmp(const Interval *interval1, const Interval *interval2)
Compare the two intervals.
Definition: pg_types.c:1189
Interval * pg_timestamp_mi(TimestampTz dt1, TimestampTz dt2)
Compute the difference of two timestamps.
Definition: pg_types.c:1135
int64 TimestampTz
Definition: pg_ext_defs.in.h:19
unsigned int uint32
Definition: pg_ext_defs.in.h:13
signed int int32
Definition: pg_ext_defs.in.h:8
unsigned long int uint64
Definition: pg_ext_defs.in.h:14
long int int64
Definition: pg_ext_defs.in.h:9
uint32 hash_bytes_uint32(uint32 k)
Definition: hashfn.c:610
float8 float8_in(const char *num, const char *type_name, const char *orig_string)
Definition: basetype_inout.c:457
float8 pg_datan2(float8 arg1, float8 arg2)
Return the arctan of arg1/arg2 (radians)
Definition: pg_types.c:188
float8 pg_datan(float8 arg1)
Return the arctan of arg1 (radians)
Definition: pg_types.c:163
uint32 pg_hashfloat8(float8 key)
Get the 32-bit hash value of an float64 value.
Definition: pg_types.c:1317
float8 pg_dcos(float8 arg1)
Return the cosine of arg1 (radians)
Definition: pg_types.c:125
float8 pg_dsin(float8 arg1)
Return the sine of arg1 (radians)
Definition: pg_types.c:101
int64 int8_in(const char *str)
Return an int8 from a string.
Definition: basetype_inout.c:262
uint64 pg_hashfloat8extended(float8 key, uint64 seed)
Get the 64-bit hash value of a float64 value.
Definition: pg_types.c:1341
int32 int4_in(const char *str)
Return an int4 from a string.
Definition: basetype_inout.c:200
uint64 pg_hashtextextended(text *key, uint64 seed)
Get the 32-bit hash value of an text value.
Definition: pg_types.c:1371
Interval * pg_interval_justify_hours(const Interval *span)
Add an interval to a timestamp data type.
Definition: pg_types.c:1103
uint32 pg_hashtext(text *key)
Get the 32-bit hash value of an text value.
Definition: pg_types.c:1358
uint64 hash_bytes_uint32_extended(uint32 k, uint64 seed)
Definition: hashfn.c:631
char * int8_out(int64 val)
Return a string from an int8.
Definition: basetype_inout.c:307
uint32 pg_hashint8(int64 val)
Get the 32-bit hash value of an int64 value.
Definition: pg_types.c:1282
uint64 pg_hashint8extended(int64 val, uint64 seed)
Get the 64-bit hash value of an int64 value.
Definition: pg_types.c:1303
char * int4_out(int32 val)
Return a string from an int4.
Definition: basetype_inout.c:239
char * float8_out(double num, int maxdd)
Definition: basetype_inout.c:473
Definition: pg_ext_defs.in.h:24
Definition: pg_ext_defs.in.h:31