@pgpm/verify 0.15.1 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Makefile CHANGED
@@ -1,5 +1,5 @@
1
1
  EXTENSION = pgpm-verify
2
- DATA = sql/pgpm-verify--0.14.0.sql
2
+ DATA = sql/pgpm-verify--0.15.2.sql
3
3
 
4
4
  PG_CONFIG = pg_config
5
5
  PGXS := $(shell $(PG_CONFIG) --pgxs)
@@ -9,12 +9,26 @@ CREATE FUNCTION verify_function (_name text, _user text DEFAULT NULL)
9
9
  AS $$
10
10
  DECLARE
11
11
  check_user text;
12
+ func_oid oid;
12
13
  BEGIN
13
14
  IF (_user IS NOT NULL) THEN
14
15
  check_user = _user;
15
16
  ELSE
16
17
  check_user = CURRENT_USER;
17
18
  END IF;
19
+ IF position('(' IN _name) > 0 THEN
20
+ func_oid = to_regprocedure(_name);
21
+ IF func_oid IS NULL THEN
22
+ RAISE EXCEPTION 'Nonexistent function --> %', _name
23
+ USING HINT = 'Please check';
24
+ END IF;
25
+ IF has_function_privilege(check_user, func_oid, 'execute') THEN
26
+ RETURN TRUE;
27
+ ELSE
28
+ RAISE EXCEPTION 'Nonexistent function --> %', _name
29
+ USING HINT = 'Please check';
30
+ END IF;
31
+ END IF;
18
32
  IF EXISTS (
19
33
  SELECT
20
34
  has_function_privilege(check_user, p.oid, 'execute')
@@ -34,4 +48,3 @@ $$
34
48
  LANGUAGE 'plpgsql'
35
49
  IMMUTABLE;
36
50
  COMMIT;
37
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpm/verify",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "description": "Verification utilities for PGPM deploy/verify/revert workflow",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "contributors": [
@@ -31,5 +31,5 @@
31
31
  "bugs": {
32
32
  "url": "https://github.com/constructive-io/pgpm-modules/issues"
33
33
  },
34
- "gitHead": "dee7b5e6073a88f1fac6ea4064dd01c2bf2cae44"
34
+ "gitHead": "187ed37f6b731132fe930acf5b5996b1e63ecca0"
35
35
  }
@@ -1,6 +1,6 @@
1
1
  # pgpm-verify extension
2
2
  comment = 'pgpm-verify extension'
3
- default_version = '0.14.0'
3
+ default_version = '0.15.2'
4
4
  module_pathname = '$libdir/pgpm-verify'
5
5
  requires = 'plpgsql'
6
6
  relocatable = false
@@ -129,12 +129,26 @@ $EOFCODE$ LANGUAGE plpgsql IMMUTABLE;
129
129
  CREATE FUNCTION verify_function(_name text, _user text DEFAULT NULL) RETURNS boolean AS $EOFCODE$
130
130
  DECLARE
131
131
  check_user text;
132
+ func_oid oid;
132
133
  BEGIN
133
134
  IF (_user IS NOT NULL) THEN
134
135
  check_user = _user;
135
136
  ELSE
136
137
  check_user = CURRENT_USER;
137
138
  END IF;
139
+ IF position('(' IN _name) > 0 THEN
140
+ func_oid = to_regprocedure(_name);
141
+ IF func_oid IS NULL THEN
142
+ RAISE EXCEPTION 'Nonexistent function --> %', _name
143
+ USING HINT = 'Please check';
144
+ END IF;
145
+ IF has_function_privilege(check_user, func_oid, 'execute') THEN
146
+ RETURN TRUE;
147
+ ELSE
148
+ RAISE EXCEPTION 'Nonexistent function --> %', _name
149
+ USING HINT = 'Please check';
150
+ END IF;
151
+ END IF;
138
152
  IF EXISTS (
139
153
  SELECT
140
154
  has_function_privilege(check_user, p.oid, 'execute')