   -- 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
 

end;
' language plpgsql;

-- U S E R S
create or replace function migrate_users() returns integer as '
declare

  next_id int;
begin

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

