   -- avoid SDS and superadmin users
   for usr in select * from dblink(''select id, first_name, password, 
       last_name, display_id, extension, ug_id 
-     from users where ug_id is not null'') 
+     from users where display_id != ''''SDS'''''') 
        as (id int, first_name text, password text, last_name text, 
        display_id text, extension text, ug_id int) loop
 

  next_id int;
begin

  -- todo weights ought to be the lower the depth, the higher to weight
  -- how do you find the depth though?
  raise notice ''DATA LOSS: User group inheritance not preserved'';

  -- todo user permissions
  raise notice ''DATA LOSS: User group permissions not migrated'';


        usr.display_id);

    -- user group
    if usr.ug_id is not null then
      insert into user_group (user_id, group_id) values (usr.id, usr.ug_id);
    end if;

  end loop; 

