You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`pgv_set_int(package text, name text, value int)` | `void`
100
+
`pgv_set_int(package text, name text, value int, is_transactional bool default false)` | `void`
85
101
`pgv_get_int(package text, name text, strict bool default true)` | `int`
86
102
87
103
### Text variables
88
104
89
105
Function | Returns
90
106
-------- | -------
91
-
`pgv_set_text(package text, name text, value text)` | `void`
107
+
`pgv_set_text(package text, name text, value text, is_transactional bool default false)` | `void`
92
108
`pgv_get_text(package text, name text, strict bool default true)` | `text`
93
109
94
110
### Numeric variables
95
111
96
112
Function | Returns
97
113
-------- | -------
98
-
`pgv_set_numeric(package text, name text, value numeric)` | `void`
114
+
`pgv_set_numeric(package text, name text, value numeric, is_transactional bool default false)` | `void`
99
115
`pgv_get_numeric(package text, name text, strict bool default true)` | `numeric`
100
116
101
117
### Timestamp variables
102
118
103
119
Function | Returns
104
120
-------- | -------
105
-
`pgv_set_timestamp(package text, name text, value timestamp)` | `void`
121
+
`pgv_set_timestamp(package text, name text, value timestamp, is_transactional bool default false)` | `void`
106
122
`pgv_get_timestamp(package text, name text, strict bool default true)` | `timestamp`
107
123
108
124
### Timestamp with timezone variables
109
125
110
126
Function | Returns
111
127
-------- | -------
112
-
`pgv_set_timestamptz(package text, name text, value timestamptz)` | `void`
128
+
`pgv_set_timestamptz(package text, name text, value timestamptz, is_transactional bool default false)` | `void`
113
129
`pgv_get_timestamptz(package text, name text, strict bool default true)` | `timestamptz`
114
130
115
131
### Date variables
116
132
117
133
Function | Returns
118
134
-------- | -------
119
-
`pgv_set_date(package text, name text, value date)` | `void`
135
+
`pgv_set_date(package text, name text, value date, is_transactional bool default false)` | `void`
120
136
`pgv_get_date(package text, name text, strict bool default true)` | `date`
121
137
122
138
### Jsonb variables
123
139
124
140
Function | Returns
125
141
-------- | -------
126
-
`pgv_set_jsonb(package text, name text, value jsonb)` | `void`
142
+
`pgv_set_jsonb(package text, name text, value jsonb, is_transactional bool default false)` | `void`
127
143
`pgv_get_jsonb(package text, name text, strict bool default true)` | `jsonb`
128
144
129
145
## Record variables functions
@@ -142,7 +158,7 @@ raised.
142
158
143
159
Function | Returns | Description
144
160
-------- | ------- | -----------
145
-
`pgv_insert(package text, name text, r record)` | `void` | Inserts a record to the variable collection. If package and variable do not exists they will be created. The first column of **r** will be a primary key. If exists a record with the same primary key the error will be raised. If this variable collection has other structure the error will be raised.
161
+
`pgv_insert(package text, name text, r record, is_transactional bool default false)` | `void` | Inserts a record to the variable collection. If package and variable do not exists they will be created. The first column of **r** will be a primary key. If exists a record with the same primary key the error will be raised. If this variable collection has other structure the error will be raised.
146
162
`pgv_update(package text, name text, r record)` | `boolean` | Updates a record with the corresponding primary key (the first column of **r** is a primary key). Returns **true** if a record was found. If this variable collection has other structure the error will be raised.
147
163
`pgv_delete(package text, name text, value anynonarray)` | `boolean` | Deletes a record with the corresponding primary key (the first column of **r** is a primary key). Returns **true** if a record was found.
148
164
`pgv_select(package text, name text)` | `set of record` | Returns the variable collection records.
@@ -158,7 +174,7 @@ Function | Returns | Description
158
174
`pgv_remove(package text, name text)` | `void` | Removes the variable with the corresponding name. Required package and variable must exists, otherwise the error will be raised.
159
175
`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.
160
176
`pgv_free()` | `void` | Removes all packages and variables.
161
-
`pgv_list()` | `table(package text, name text)` | Returns set of records of assigned packages and variables.
177
+
`pgv_list()` | `table(package text, name text, is_transactional bool)` | Returns set of records of assigned packages and variables.
162
178
`pgv_stats()` | `table(package text, used_memory bigint)` | Returns list of assigned packages and used memory in bytes.
163
179
164
180
Note that **pgv_stats()** works only with the PostgreSQL 9.6 and newer.
If you create variable after `BEGIN` or `SAVEPOINT` and than rollback to previous state - variable will not be exist:
318
+
```sql
319
+
BEGIN;
320
+
SAVEPOINT sp1;
321
+
SAVEPOINT sp2;
322
+
SELECT pgv_set('pack', 'var_int', 122, true);
323
+
RELEASE SAVEPOINT sp2;
324
+
SELECT pgv_get('pack', 'var_int', NULL::int);
325
+
pgv_get
326
+
---------
327
+
122
328
+
(1 row)
329
+
330
+
ROLLBACK TO sp1;
331
+
SELECT pgv_get('pack','var_int', NULL::int);
332
+
ERROR: unrecognized variable "var_int"
333
+
COMMIT;
334
+
```
335
+
If you created transactional variable once, you should use flag `is_transactional` every time when you want to change variable value by functions `pgv_set()`, `pgv_insert()` and deprecated setters (i.e. `pgv_set_int()`). If you try to change this option, you'll get an error:
0 commit comments