@@ -9,9 +9,9 @@ Note that the module does **not support transactions and savepoints**. For
99example:
1010
1111``` sql
12- SELECT pgv_set_int (' vars' , ' int1' , 101 );
12+ SELECT pgv_set (' vars' , ' int1' , 101 );
1313BEGIN ;
14- SELECT pgv_set_int (' vars' , ' int2' , 102 );
14+ SELECT pgv_set (' vars' , ' int2' , 102 );
1515ROLLBACK ;
1616
1717SELECT * FROM pgv_list() order by package, name;
@@ -42,32 +42,41 @@ Typical installation procedure may look like this:
4242The functions provided by the ** pg_variables** module are shown in the tables
4343below. The module supports the following scalar and record types.
4444
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 .
4848
4949If a package does not exists you will get the following error:
5050
5151``` sql
52- SELECT pgv_get_int (' vars' , ' int1' );
52+ SELECT pgv_get (' vars' , ' int1' , NULL :: int );
5353ERROR: unrecognized package " vars"
5454```
5555
5656If a variable does not exists you will get the following error:
5757
5858``` sql
59- SELECT pgv_get_int (' vars' , ' int1' );
59+ SELECT pgv_get (' vars' , ' int1' , NULL :: int );
6060ERROR: unrecognized variable " int1"
6161```
6262
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
6464match with the function type the error will be raised:
6565
6666``` sql
67- SELECT pgv_get_text (' vars' , ' int1' );
67+ SELECT pgv_get (' vars' , ' int1' , NULL :: text );
6868ERROR: variable " int1" requires " integer" value
6969```
7070
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+
7180### Integer variables
7281
7382Function | Returns
@@ -117,7 +126,7 @@ Function | Returns
117126` pgv_set_jsonb(package text, name text, value jsonb) ` | ` void `
118127` pgv_get_jsonb(package text, name text, strict bool default true) ` | ` jsonb `
119128
120- ### Records
129+ ## Record variables functions
121130
122131The following functions are provided by the module to work with collections of
123132record types.
@@ -159,16 +168,16 @@ Note that **pgv_stats()** works only with the PostgreSQL 9.6 and newer.
159168It is easy to use functions to work with scalar variables:
160169
161170``` 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 );
164173
165- SELECT pgv_get_int (' vars' , ' int1' );
174+ SELECT pgv_get (' vars' , ' int1' , NULL :: int );
166175 pgv_get_int
167176-- -----------
168177 101
169178(1 row)
170179
171- SELECT pgv_get_int (' vars' , ' int2' );
180+ SELECT pgv_get (' vars' , ' int2' , NULL :: int );
172181 pgv_get_int
173182-- -----------
174183 102
0 commit comments