Skip to content

Commit f5726ba

Browse files
committed
Add text variable example
1 parent 550582d commit f5726ba

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ Function | Returns | Description
178178
`pgv_remove(package text)` | `void` | Removes the package and all package variables with the corresponding name. Required package must exists, otherwise the error will be raised.
179179
`pgv_free()` | `void` | Removes all packages and variables.
180180
`pgv_list()` | `table(package text, name text, is_transactional bool)` | Returns set of records of assigned packages and variables.
181-
`pgv_stats()` | `table(package text, used_memory bigint)` | Returns list of assigned packages and used memory in bytes.
181+
`pgv_stats()` | `table(package text, allocated_memory bigint)` | Returns list of assigned packages and used memory in bytes.
182182

183183
Note that **pgv_stats()** works only with the PostgreSQL 9.6 and newer.
184184

@@ -188,18 +188,18 @@ It is easy to use functions to work with scalar variables:
188188

189189
```sql
190190
SELECT pgv_set('vars', 'int1', 101);
191-
SELECT pgv_set('vars', 'int2', 102);
191+
SELECT pgv_set('vars', 'text1', 'text variable'::text);
192192

193193
SELECT pgv_get('vars', 'int1', NULL::int);
194194
pgv_get_int
195195
-------------
196196
101
197197
(1 row)
198198

199-
SELECT pgv_get('vars', 'int2', NULL::int);
200-
pgv_get_int
201-
-------------
202-
102
199+
SELECT SELECT pgv_get('vars', 'text1', NULL::text);
200+
pgv_get
201+
---------------
202+
text variable
203203
(1 row)
204204
```
205205

@@ -254,21 +254,21 @@ You can list packages and variables:
254254

255255
```sql
256256
SELECT * FROM pgv_list() order by package, name;
257-
package | name | is_transactional
258-
---------+------+------------------
259-
vars | int1 | f
260-
vars | int2 | f
261-
vars | r1 | f
257+
package | name | is_transactional
258+
---------+-------+------------------
259+
vars | int1 | f
260+
vars | r1 | f
261+
vars | text1 | f
262262
(3 rows)
263263
```
264264

265265
And get used memory in bytes:
266266

267267
```sql
268268
SELECT * FROM pgv_stats() order by package;
269-
package | used_memory
270-
---------+-------------
271-
vars | 16736
269+
package | allocated_memory
270+
---------+------------------
271+
vars | 32768
272272
(1 row)
273273
```
274274

0 commit comments

Comments
 (0)