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
Copy file name to clipboardExpand all lines: pg_tle--1.3.4--1.4.0.sql
+77Lines changed: 77 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,71 @@ END;
60
60
$_pgtleie_$
61
61
LANGUAGE plpgsql STRICT;
62
62
63
+
-- Helper function to register features in the feature_info table
64
+
CREATE OR REPLACEFUNCTIONpgtle.register_feature(proc regproc, feature pgtle.pg_tle_features)
65
+
RETURNS VOID
66
+
LANGUAGE plpgsql
67
+
AS $$
68
+
DECLARE
69
+
pg_proc_relid oid;
70
+
proc_oid oid;
71
+
schema_name text;
72
+
nspoid oid;
73
+
proname text;
74
+
proc_schema_name text;
75
+
ident text;
76
+
passcheck_enabled text;
77
+
clientauth_enabled text;
78
+
current_db text;
79
+
passcheck_db text;
80
+
clientauth_db text;
81
+
82
+
BEGIN
83
+
SELECT setting FROMpg_catalog.pg_settingsWHERE name ='pgtle.enable_password_check' INTO passcheck_enabled;
84
+
SELECT setting FROMpg_catalog.pg_settingsWHERE name ='pgtle.enable_clientauth' INTO clientauth_enabled;
85
+
SELECTpg_catalog.CURRENT_DATABASE() INTO current_db;
86
+
SELECT setting FROMpg_catalog.pg_settingsWHERE name ='pgtle.passcheck_db_name' INTO passcheck_db;
87
+
SELECT setting FROMpg_catalog.pg_settingsWHERE name ='pgtle.clientauth_db_name' INTO clientauth_db;
88
+
89
+
IF feature ='passcheck' THEN
90
+
IF passcheck_enabled ='off' THEN
91
+
RAISE NOTICE 'pgtle.enable_password_check is set to off. To enable passcheck, set pgtle.enable_password_check = on';
92
+
ELSE
93
+
-- passcheck_db_name is an optional param, we only emit a warning if it's non-empty and is not the current database
94
+
IF passcheck_db !=''AND current_db != passcheck_db THEN
95
+
RAISE NOTICE '%', pg_catalog.FORMAT('pgtle.passcheck_db_name is currently %I. To trigger this passcheck function, register the function in that database.', passcheck_db)
96
+
USING HINT =pg_catalog.FORMAT('Alternatively, to use the current database for passcheck, set pgtle.passcheck_db_name = %I and reload the PostgreSQL configuration.', current_db);
97
+
END IF;
98
+
END IF;
99
+
END IF;
100
+
101
+
IF feature ='clientauth' THEN
102
+
IF clientauth_enabled ='off' THEN
103
+
RAISE NOTICE 'pgtle.enable_clientauth is set to off. To enable clientauth, set pgtle.enable_clientauth = on';
104
+
ELSE
105
+
IF current_db != clientauth_db THEN
106
+
RAISE NOTICE '%', pg_catalog.FORMAT('pgtle.clientauth_db_name is currently %I. To trigger this clientauth function, register the function in that database.', clientauth_db)
107
+
USING HINT =pg_catalog.FORMAT('Alternatively, to use the current database for clientauth, set pgtle.clientauth_db_name = %I and reload the PostgreSQL configuration.', current_db);
108
+
END IF;
109
+
END IF;
110
+
END IF;
111
+
112
+
SELECToid into nspoid FROMpg_catalog.pg_namespace
113
+
where nspname ='pg_catalog';
114
+
115
+
SELECToid into pg_proc_relid frompg_catalog.pg_class
116
+
where relname ='pg_proc'and relnamespace = nspoid;
117
+
118
+
SELECTpg_namespace.nspname, pg_proc.oid, pg_proc.proname into proc_schema_name, proc_oid, proname FROM
NOTICE: pgtle.passcheck_db_name is currently test. To trigger this passcheck function, register the function in that database.
408
+
HINT: Alternatively, to use the current database for passcheck, set pgtle.passcheck_db_name = contrib_regression and reload the PostgreSQL configuration.
NOTICE: pgtle.clientauth_db_name is currently postgres. To trigger this clientauth function, register the function in that database.
454
+
HINT: Alternatively, to use the current database for clientauth, set pgtle.clientauth_db_name = contrib_regression and reload the PostgreSQL configuration.
0 commit comments