@@ -9,9 +9,9 @@ Note that the module does **not support transactions and savepoints**. For
9
9
example:
10
10
11
11
``` sql
12
- SELECT pgv_set_int (' vars' , ' int1' , 101 );
12
+ SELECT pgv_set (' vars' , ' int1' , 101 );
13
13
BEGIN ;
14
- SELECT pgv_set_int (' vars' , ' int2' , 102 );
14
+ SELECT pgv_set (' vars' , ' int2' , 102 );
15
15
ROLLBACK ;
16
16
17
17
SELECT * FROM pgv_list() order by package, name;
@@ -42,32 +42,41 @@ Typical installation procedure may look like this:
42
42
The functions provided by the ** pg_variables** module are shown in the tables
43
43
below. The module supports the following scalar and record types.
44
44
45
- To use ** pgv_get _ ()** functions required package and variable must exists. It is
46
- necessary to set variable with ** pgv_set _ ()** functions to use ** pgv_get _ ()**
47
- functions .
45
+ To use ** pgv_get ()** function required package and variable must exists. It is
46
+ necessary to set variable with ** pgv_set ()** function to use ** pgv_get ()**
47
+ function .
48
48
49
49
If a package does not exists you will get the following error:
50
50
51
51
``` sql
52
- SELECT pgv_get_int (' vars' , ' int1' );
52
+ SELECT pgv_get (' vars' , ' int1' , NULL :: int );
53
53
ERROR: unrecognized package " vars"
54
54
```
55
55
56
56
If a variable does not exists you will get the following error:
57
57
58
58
``` sql
59
- SELECT pgv_get_int (' vars' , ' int1' );
59
+ SELECT pgv_get (' vars' , ' int1' , NULL :: int );
60
60
ERROR: unrecognized variable " int1"
61
61
```
62
62
63
- ** pgv_get _ ()** functions check the variable type. If the variable type does not
63
+ ** pgv_get ()** function check the variable type. If the variable type does not
64
64
match with the function type the error will be raised:
65
65
66
66
``` sql
67
- SELECT pgv_get_text (' vars' , ' int1' );
67
+ SELECT pgv_get (' vars' , ' int1' , NULL :: text );
68
68
ERROR: variable " int1" requires " integer" value
69
69
```
70
70
71
+ ## Scalar variables functions
72
+
73
+ Function | Returns
74
+ -------- | -------
75
+ ` pgv_set(package text, name text, value anynonarray) ` | ` void `
76
+ ` pgv_get(package text, name text, var_type anynonarray, strict bool default true) ` | ` anynonarray `
77
+
78
+ ## ** Deprecated** scalar variables functions
79
+
71
80
### Integer variables
72
81
73
82
Function | Returns
@@ -117,7 +126,7 @@ Function | Returns
117
126
` pgv_set_jsonb(package text, name text, value jsonb) ` | ` void `
118
127
` pgv_get_jsonb(package text, name text, strict bool default true) ` | ` jsonb `
119
128
120
- ### Records
129
+ ## Record variables functions
121
130
122
131
The following functions are provided by the module to work with collections of
123
132
record types.
@@ -159,16 +168,16 @@ Note that **pgv_stats()** works only with the PostgreSQL 9.6 and newer.
159
168
It is easy to use functions to work with scalar variables:
160
169
161
170
``` sql
162
- SELECT pgv_set_int (' vars' , ' int1' , 101 );
163
- SELECT pgv_set_int (' vars' , ' int2' , 102 );
171
+ SELECT pgv_set (' vars' , ' int1' , 101 );
172
+ SELECT pgv_set (' vars' , ' int2' , 102 );
164
173
165
- SELECT pgv_get_int (' vars' , ' int1' );
174
+ SELECT pgv_get (' vars' , ' int1' , NULL :: int );
166
175
pgv_get_int
167
176
-- -----------
168
177
101
169
178
(1 row)
170
179
171
- SELECT pgv_get_int (' vars' , ' int2' );
180
+ SELECT pgv_get (' vars' , ' int2' , NULL :: int );
172
181
pgv_get_int
173
182
-- -----------
174
183
102
0 commit comments