Forum OpenACS Q&A: Re: Duplicates in registered_users

Collapse
Posted by Peter Marklund on
I can reproduce this problem by going to the start page of a clean OpenACS install, click the members link, click invite, and choose to create a new user. Make the new user an admin (the duplication doesn't seem to occur otherwise). Here is my psql debug output and workaround (different from Samer's workaround interestingly) from after having added the admin user (mailto:peter@collaboraid.biz is the new user I created):

select user_id, email from registered_users;
user_id |        email
---------+-----------------------
    584 | mailto:demo@demo.test
    653 | mailto:peter@collaboraid.biz
    653 | mailto:peter@collaboraid.biz
(3 rows)

select * from group_member_index;
group_id | member_id | rel_id | container_id |    rel_type
----------+-----------+--------+--------------+----------------
      -1 |        0 |      5 |          -1 | membership_rel
      -2 |      584 |    585 |          -2 | membership_rel
      -1 |      584 |    585 |          -2 | membership_rel
      -2 |      653 |    655 |          -2 | membership_rel
      -1 |      653 |    655 |          -2 | membership_rel
      -2 |      653 |    656 |          -2 | admin_rel
      -1 |      653 |    656 |          -2 | admin_rel

(note user is both in admin_rel and membership_rel).

simulation=# drop view registered_users;
DROP VIEW
simulation=# create view registered_users
as
  select p.email, p.url, pe.first_names, pe.last_name, u.*, mr.member_state
  from parties p, persons pe, users u, group_member_map m, membership_rels mr, acs_magic_objects amo
  where party_id = person_id
  and person_id = user_id
  and u.user_id = m.member_id
  and m.rel_id = mr.rel_id
  and amo.name = 'registered_users'
  and m.group_id = amo.object_id
  and mr.member_state = 'approved'
  and m.rel_type = 'membership_rel'
  and u.email_verified_p = 't';

select user_id, email from registered_users;
user_id |        email
---------+-----------------------
    584 | mailto:demo@demo.test
    653 | mailto:peter@collaboraid.biz
(2 rows)

Don, Lars and others, what do you make of this?