From 4e5568bf19d0455c5c1ccfbf75cce44195b5066f Mon Sep 17 00:00:00 2001 From: dodger Date: Fri, 21 Jan 2022 17:47:10 +0100 Subject: [PATCH] added fields to the audit table --- passchanger.sql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/passchanger.sql b/passchanger.sql index 3a066e3..7eb6fc8 100644 --- a/passchanger.sql +++ b/passchanger.sql @@ -22,6 +22,10 @@ CREATE TABLE IF NOT EXISTS dba.pwdhistory ) TABLESPACE pg_default; +-- alter if you come from a previous version of the table: +-- alter table dba.pwdhistory add column usename_addres character varying ; +-- alter table dba.pwdhistory add column application_name character varying ; + ALTER TABLE IF EXISTS dba.pwdhistory OWNER to dba; @@ -82,8 +86,8 @@ declare _userapp text := ''; begin select user into _usename; - select client_addr user into _useraddress from pg_stat_activity where pid = pg_backend_pid() ; - select application_name user into _userapp from pg_stat_activity where pid = pg_backend_pid() ; + select client_addr into _useraddress from pg_stat_activity where pid = pg_backend_pid() ; + select application_name into _userapp from pg_stat_activity where pid = pg_backend_pid() ; if length(_password) >= _min_password_length then EXECUTE format('ALTER USER %I WITH PASSWORD %L', _usename, _password); else -- also catches NULL