platform-db/changesets/registry/procedures/p_grant_analytics_user.sql [19:43]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 LANGUAGE plpgsql
AS $procedure$
DECLARE
  c_obj_pattern TEXT := 'report%v';
  r RECORD;
  is_role_found integer;
  v_user_name text := replace(p_user_name, '"', '');
BEGIN
  if p_table_name is not null then
    if not exists (select from information_schema.views 
                   where table_name = p_table_name 
                   and table_schema = 'registry') then
      raise exception 'Table [%] is not found', p_table_name;
    end if;
    c_obj_pattern := p_table_name;
  end if;
  -- check if role exists
  select 1
    into is_role_found
    from pg_catalog.pg_roles
    where rolname = v_user_name;

  if is_role_found is null then
    raise exception 'Role [%] is not found', v_user_name;
  end if;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



platform-db/changesets/registry/procedures/p_revoke_analytics_user.sql [4:28]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 LANGUAGE plpgsql
AS $procedure$
DECLARE
  c_obj_pattern TEXT := 'report%v';
  r RECORD;
  is_role_found integer;
  v_user_name text := replace(p_user_name, '"', '');
BEGIN
  if p_table_name is not null then
    if not exists (select from information_schema.views 
                   where table_name = p_table_name 
                   and table_schema = 'registry') then
      raise exception 'Table [%] is not found', p_table_name;
    end if;
    c_obj_pattern := p_table_name;
  end if;
  -- check if role exists
  select 1
    into is_role_found
    from pg_catalog.pg_roles
    where rolname = v_user_name;

  if is_role_found is null then
    raise exception 'Role [%] is not found', v_user_name;
  end if;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



