store_application_name(i_name text)

8.117. store_application_name(i_name text)

Function Properties

Language: PLPGSQL

Return Type: text

Set application_name GUC, if possible. Returns NULL if it fails to work.

declare
		p_command text;
begin
		if exists (select 1 from pg_catalog.pg_settings where name = 'application_name') then
		   p_command := 'set application_name to '''|| i_name || ''';';
		   execute p_command;
		   return i_name;
		end if;
		return NULL::text;
end