Debian Codegraph @

src/modules/db_postgres/README

raw
1 postgres Module
2
3 Greg Fausak
4
5 August.net
6
7 Edited by
8
9 Greg Fausak
10
11 Copyright © 2003 Greg Fausak
12 __________________________________________________________________
13
14 Table of Contents
15
16 1. Admin Guide
17
18 1. Overview
19 2. Dependencies
20
21 2.1. Kamailio Modules
22 2.2. External Libraries or Applications
23
24 3. Parameters
25
26 3.1. retries (integer)
27 3.2. timeout (integer)
28 3.3. tcp_keepalive (integer)
29 3.4. lockset (integer)
30 3.5. bytea_output_escape (integer)
31 3.6. con_param (str)
32
33 4. Functions
34
35 List of Examples
36
37 1.1. Set retries parameter
38 1.2. Set timeout parameter
39 1.3. Set tcp_keepalive parameter
40 1.4. Set lockset parameter
41 1.5. Set bytea_output_escape parameter
42 1.6. Set con_param parameter
43
44 Chapter 1. Admin Guide
45
46 Table of Contents
47
48 1. Overview
49 2. Dependencies
50
51 2.1. Kamailio Modules
52 2.2. External Libraries or Applications
53
54 3. Parameters
55
56 3.1. retries (integer)
57 3.2. timeout (integer)
58 3.3. tcp_keepalive (integer)
59 3.4. lockset (integer)
60 3.5. bytea_output_escape (integer)
61 3.6. con_param (str)
62
63 4. Functions
64
65 1. Overview
66
67 The module is an implementation of the internal DB API v1 and v2
68 connector for PostgreSQL server. It has support for reconnecting when
69 the connection is broken.
70
71 2. Dependencies
72
73 2.1. Kamailio Modules
74 2.2. External Libraries or Applications
75
76 2.1. Kamailio Modules
77
78 The following modules must be loaded before this module:
79 * No dependencies on other Kamailio modules.
80
81 2.2. External Libraries or Applications
82
83 The following libraries or applications must be installed before
84 running Kamailio with this module loaded:
85 * PostgreSQL library - e.g., libpq5.
86 * PostgreSQL devel library - to compile the module (e.g., libpq-dev).
87
88 3. Parameters
89
90 3.1. retries (integer)
91 3.2. timeout (integer)
92 3.3. tcp_keepalive (integer)
93 3.4. lockset (integer)
94 3.5. bytea_output_escape (integer)
95 3.6. con_param (str)
96
97 3.1. retries (integer)
98
99 How many retries to attempt to reconnect if connection to Postgres
100 server becomes broken.
101
102 Default value is 2 (that means three attempts to submit the query,
103 first will trigger the connection error and two more (the value of this
104 parameter) after resetting the connection).
105
106 Example 1.1. Set retries parameter
107 ...
108 modparam("db_postgres", "retries", 3)
109 ...
110
111 3.2. timeout (integer)
112
113 Setting this variable to any value larger than zero (which is the
114 default value) enables mainly query timeout. For backward compatibility
115 it also enables connection timeout if connect_timeout param is not set
116 using the con_param below. If a connection attempt or a query takes
117 longer than this many seconds, the operation will be aborted and an
118 error will be returned.
119
120 Note that this timeout is applied to each underlying operation (i.e.
121 for each connection attempt), so depending on circumstances and on the
122 value of the “retries” variable, a single query from the SIP proxy's
123 point of view can take longer than the “timeout”.
124
125 Example 1.2. Set timeout parameter
126 ...
127 modparam("db_postgres", "timeout", 10)
128 ...
129
130 3.3. tcp_keepalive (integer)
131
132 Enable the TCP keepalive timer and set the number of seconds the
133 connection must be idle before to start sending keepalive packets.
134 Defaults to zero, which disables TCP keepalive packets.
135
136 Only supported on platforms which understand and support the
137 “TCP_KEEPIDLE” socket option.
138
139 Example 1.3. Set tcp_keepalive parameter
140 ...
141 modparam("db_postgres", "tcp_keepalive", 600)
142 ...
143
144 3.4. lockset (integer)
145
146 The value is used as power of two to compute the size of the lock set
147 needed to implement the equivalent of REPLACE SQL statement.
148
149 Default value is 4 (lock set size is 16).
150
151 Example 1.4. Set lockset parameter
152 ...
153 modparam("db_postgres", "lockset", 6)
154 ...
155
156 3.5. bytea_output_escape (integer)
157
158 Control if the module should request escaping the output for bytea
159 fields.
160
161 Default value is 1 (do the escape).
162
163 Example 1.5. Set bytea_output_escape parameter
164 ...
165 modparam("db_postgres", "bytea_output_escape", 0)
166 ...
167
168 3.6. con_param (str)
169
170 Specifies the connection string parameters. Parameter definition must
171 be in the format param1=value1;param2=value2. Many parameters can be
172 set.
173
174 NOTE: See postgres connection keyword list
175 (https://www.postgresql.org/docs/12/libpq-connect.html#LIBPQ-PARAMKEYWO
176 RDS)
177
178 Example 1.6. Set con_param parameter
179 ...
180 modparam("db_postgres", "con_param", "connect_timeout=15;tcp_user_timeout=5000")
181 ...
182
183 4. Functions
184
185 NONE