PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
builtins.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * builtins.h
4  * Declarations for operations on built-in types.
5  *
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/utils/builtins.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef BUILTINS_H
15 #define BUILTINS_H
16 
17 #include "fmgr.h"
18 #include "nodes/nodes.h"
19 #include "utils/fmgrprotos.h"
20 
21 
22 /* bool.c */
23 extern bool parse_bool(const char *value, bool *result);
24 extern bool parse_bool_with_len(const char *value, size_t len, bool *result);
25 
26 /* domains.c */
27 extern void domain_check(Datum value, bool isnull, Oid domainType,
28  void **extra, MemoryContext mcxt);
29 extern int errdatatype(Oid datatypeOid);
30 extern int errdomainconstraint(Oid datatypeOid, const char *conname);
31 
32 /* encode.c */
33 extern unsigned hex_encode(const char *src, unsigned len, char *dst);
34 extern unsigned hex_decode(const char *src, unsigned len, char *dst);
35 
36 /* int.c */
37 extern int2vector *buildint2vector(const int16 *int2s, int n);
38 
39 /* name.c */
40 extern int namecpy(Name n1, Name n2);
41 extern int namestrcpy(Name name, const char *str);
42 extern int namestrcmp(Name name, const char *str);
43 
44 /* numutils.c */
45 extern int32 pg_atoi(const char *s, int size, int c);
46 extern void pg_itoa(int16 i, char *a);
47 extern void pg_ltoa(int32 l, char *a);
48 extern void pg_lltoa(int64 ll, char *a);
49 extern char *pg_ltostr_zeropad(char *str, int32 value, int32 minwidth);
50 extern char *pg_ltostr(char *str, int32 value);
51 extern uint64 pg_strtouint64(const char *str, char **endptr, int base);
52 
53 /* float.c */
55 
56 extern double get_float8_infinity(void);
57 extern float get_float4_infinity(void);
58 extern double get_float8_nan(void);
59 extern float get_float4_nan(void);
60 extern int is_infinite(double val);
61 extern double float8in_internal(char *num, char **endptr_p,
62  const char *type_name, const char *orig_string);
63 extern char *float8out_internal(double num);
64 extern int float4_cmp_internal(float4 a, float4 b);
65 extern int float8_cmp_internal(float8 a, float8 b);
66 
67 /* oid.c */
68 extern oidvector *buildoidvector(const Oid *oids, int n);
69 extern Oid oidparse(Node *node);
70 extern int oid_cmp(const void *p1, const void *p2);
71 
72 /* regexp.c */
73 extern char *regexp_fixed_prefix(text *text_re, bool case_insensitive,
74  Oid collation, bool *exact);
75 
76 /* ruleutils.c */
77 extern bool quote_all_identifiers;
78 extern const char *quote_identifier(const char *ident);
79 extern char *quote_qualified_identifier(const char *qualifier,
80  const char *ident);
81 
82 /* varchar.c */
83 extern int bpchartruelen(char *s, int len);
84 
85 /* popular functions from varlena.c */
86 extern text *cstring_to_text(const char *s);
87 extern text *cstring_to_text_with_len(const char *s, int len);
88 extern char *text_to_cstring(const text *t);
89 extern void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len);
90 
91 #define CStringGetTextDatum(s) PointerGetDatum(cstring_to_text(s))
92 #define TextDatumGetCString(d) text_to_cstring((text *) DatumGetPointer(d))
93 
94 /* xid.c */
95 extern int xidComparator(const void *arg1, const void *arg2);
96 
97 /* inet_cidr_ntop.c */
98 extern char *inet_cidr_ntop(int af, const void *src, int bits,
99  char *dst, size_t size);
100 
101 /* inet_net_pton.c */
102 extern int inet_net_pton(int af, const char *src,
103  void *dst, size_t size);
104 
105 /* network.c */
106 extern double convert_network_to_scalar(Datum value, Oid typid);
107 extern Datum network_scan_first(Datum in);
108 extern Datum network_scan_last(Datum in);
109 extern void clean_ipv6_addr(int addr_family, char *addr);
110 
111 /* numeric.c */
113 
114 /* format_type.c */
115 extern char *format_type_be(Oid type_oid);
116 extern char *format_type_be_qualified(Oid type_oid);
117 extern char *format_type_with_typemod(Oid type_oid, int32 typemod);
118 extern char *format_type_with_typemod_qualified(Oid type_oid, int32 typemod);
119 extern int32 type_maximum_size(Oid type_oid, int32 typemod);
120 
121 /* quote.c */
122 extern char *quote_literal_cstr(const char *rawstr);
123 
124 #endif /* BUILTINS_H */
char * format_type_be(Oid type_oid)
Definition: format_type.c:94
signed short int16
Definition: c.h:255
Definition: c.h:478
void pg_lltoa(int64 ll, char *a)
Definition: numutils.c:186
const char * quote_identifier(const char *ident)
Definition: ruleutils.c:10381
void domain_check(Datum value, bool isnull, Oid domainType, void **extra, MemoryContext mcxt)
Definition: domains.c:326
void clean_ipv6_addr(int addr_family, char *addr)
Definition: network.c:1504
char * format_type_with_typemod(Oid type_oid, int32 typemod)
Definition: format_type.c:113
unsigned hex_decode(const char *src, unsigned len, char *dst)
Definition: encode.c:156
bool quote_all_identifiers
Definition: ruleutils.c:298
void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len)
Definition: varlena.c:213
int namestrcpy(Name name, const char *str)
Definition: name.c:216
int errdatatype(Oid datatypeOid)
Definition: domains.c:359
int float8_cmp_internal(float8 a, float8 b)
Definition: float.c:1052
Definition: nodes.h:509
double get_float8_infinity(void)
Definition: float.c:121
char * pg_ltostr_zeropad(char *str, int32 value, int32 minwidth)
Definition: numutils.c:257
return result
Definition: formatting.c:1633
Oid oidparse(Node *node)
Definition: oid.c:314
int errdomainconstraint(Oid datatypeOid, const char *conname)
Definition: domains.c:383
int inet_net_pton(int af, const char *src, void *dst, size_t size)
Definition: inet_net_pton.c:62
int float4_cmp_internal(float4 a, float4 b)
Definition: float.c:938
unsigned int Oid
Definition: postgres_ext.h:31
char * format_type_with_typemod_qualified(Oid type_oid, int32 typemod)
Definition: format_type.c:123
bool parse_bool(const char *value, bool *result)
Definition: bool.c:30
#define PGDLLIMPORT
Definition: c.h:1064
signed int int32
Definition: c.h:256
Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS)
Definition: numeric.c:3118
int32 pg_atoi(const char *s, int size, int c)
Definition: numutils.c:37
oidvector * buildoidvector(const Oid *oids, int n)
Definition: oid.c:167
char * inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size)
uint64 pg_strtouint64(const char *str, char **endptr, int base)
Definition: numutils.c:405
Datum network_scan_first(Datum in)
Definition: network.c:1091
void pg_ltoa(int32 l, char *a)
Definition: numutils.c:132
double float8
Definition: c.h:381
int2vector * buildint2vector(const int16 *int2s, int n)
Definition: int.c:112
PGDLLIMPORT int extra_float_digits
Definition: float.c:68
static struct @121 value
bool parse_bool_with_len(const char *value, size_t len, bool *result)
Definition: bool.c:36
Definition: c.h:493
Datum network_scan_last(Datum in)
Definition: network.c:1105
char * c
char * quote_literal_cstr(const char *rawstr)
Definition: quote.c:102
int32 type_maximum_size(Oid type_oid, int32 typemod)
Definition: format_type.c:389
char * format_type_be_qualified(Oid type_oid)
Definition: format_type.c:104
float float4
Definition: c.h:380
Definition: c.h:467
char * regexp_fixed_prefix(text *text_re, bool case_insensitive, Oid collation, bool *exact)
Definition: regexp.c:1300
int namestrcmp(Name name, const char *str)
Definition: name.c:247
float get_float4_infinity(void)
Definition: float.c:146
int bpchartruelen(char *s, int len)
Definition: varchar.c:660
uintptr_t Datum
Definition: postgres.h:372
double float8in_internal(char *num, char **endptr_p, const char *type_name, const char *orig_string)
Definition: float.c:444
text * cstring_to_text(const char *s)
Definition: varlena.c:149
int is_infinite(double val)
Definition: float.c:199
char * float8out_internal(double num)
Definition: float.c:596
char * quote_qualified_identifier(const char *qualifier, const char *ident)
Definition: ruleutils.c:10467
unsigned hex_encode(const char *src, unsigned len, char *dst)
Definition: encode.c:126
int oid_cmp(const void *p1, const void *p2)
Definition: oid.c:336
double get_float8_nan(void)
Definition: float.c:166
void pg_itoa(int16 i, char *a)
Definition: numutils.c:120
const char * name
Definition: encode.c:521
int i
char * text_to_cstring(const text *t)
Definition: varlena.c:182
Definition: c.h:439
#define PG_FUNCTION_ARGS
Definition: fmgr.h:158
int xidComparator(const void *arg1, const void *arg2)
Definition: xid.c:138
char * pg_ltostr(char *str, int32 value)
Definition: numutils.c:334
long val
Definition: informix.c:689
double convert_network_to_scalar(Datum value, Oid typid)
Definition: network.c:897
float get_float4_nan(void)
Definition: float.c:179
text * cstring_to_text_with_len(const char *s, int len)
Definition: varlena.c:161
int namecpy(Name n1, Name n2)
Definition: name.c:191