Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4cdfe45

Browse files
author
Artur Zakirov
committed
Fix the error with strict = false parameter
1 parentae89d20 commit4cdfe45

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

‎contrib/pg_variables/expected/pg_variables.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
CREATE EXTENSION pg_variables;
22
-- Integer variables
3+
SELECT pgv_get_int('vars', 'int1');
4+
ERROR: unrecognized package "vars"
5+
SELECT pgv_get_int('vars', 'int1', false);
6+
pgv_get_int
7+
-------------
8+
9+
(1 row)
10+
311
SELECT pgv_set_int('vars', 'int1', 101);
412
pgv_set_int
513
-------------

‎contrib/pg_variables/pg_variables.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ variable_get(text *package_name, text *var_name,
132132
ScalarVar*scalar;
133133

134134
package=getPackageByName(package_name, false,strict);
135+
if (package==NULL)
136+
{
137+
*is_null= true;
138+
return0;
139+
}
140+
135141
variable=getVariableByNameWithType(package->variablesHash,
136142
var_name,typid, false,strict);
137143

‎contrib/pg_variables/sql/pg_variables.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
CREATE EXTENSION pg_variables;
22

33
-- Integer variables
4+
SELECT pgv_get_int('vars','int1');
5+
SELECT pgv_get_int('vars','int1', false);
6+
47
SELECT pgv_set_int('vars','int1',101);
58
SELECT pgv_set_int('vars','int2',102);
69

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp