Created
April 23, 2019 21:34
-
-
Save renerdias/c4894b00cbb6f8fc0e49b38393593886 to your computer and use it in GitHub Desktop.
Funções auxiliares para auditoria
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace function auditoria.func_application_name(iprocpid int) returns text as | |
$body$ | |
declare | |
tApplicationName text; | |
begin | |
select | |
application_name into tApplicationName | |
from | |
pg_stat_activity | |
where | |
(pid = iprocpid); | |
return tApplicationName; | |
end; | |
$body$ | |
language 'plpgsql'; | |
create or replace function auditoria.func_application_name() returns text as | |
$body$ | |
declare | |
tApplicationName text; | |
begin | |
tApplicationName := auditoria.func_application_name(pg_backend_pid()); | |
return tApplicationName; | |
end; | |
$body$ | |
language 'plpgsql'; | |
create or replace function auditoria.func_client_hostname(iprocpid int) returns text as | |
$body$ | |
declare | |
tClientHostName text; | |
begin | |
select | |
client_hostname into tClientHostName | |
from | |
pg_stat_activity | |
where | |
(pid = iprocpid); | |
return tClientHostName; | |
end; | |
$body$ | |
language 'plpgsql'; | |
create or replace function auditoria.func_client_hostname() returns text as | |
$body$ | |
declare | |
tClientHostName text; | |
begin | |
tClientHostName := auditoria.func_client_hostname(pg_backend_pid()); | |
return tClientHostName; | |
end; | |
$body$ | |
language 'plpgsql' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment