OpenSlides / OpenSlides/openslides-meta

Fix log_modified_related_models for nm-tables

Open
#492 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clean up
Dominant language
PLpgSQL
Stars
0
Forks
25
Avg merge
1d 2h
Merged PRs (30d)
12

Description

Current entries in os_notify_log_t generated on DELETE of meeting_user/1 (user_id=1, meeting_id=1, group_id=2):

 operation |      fqid      |                updated_fields                | xact_id 
-----------+----------------+----------------------------------------------+---------
 update    | meeting_user/1 | {group_ids}                                  |    2647
 update    | group/2        | {meeting_user_ids}                           |    2647
 delete    | meeting_user/1 |                                              |    2647
 update    | user/2         | {meeting_ids,committee_ids,meeting_user_ids} |    2647
 update    | meeting/1      | {user_ids,meeting_user_ids}                  |    2647
 update    | committee/60   | {user_ids}                                   |    2647

Line 1 is obsolete and should not be generated if the instance gets deleted.

The line above was created by this notify trigger:

CREATE TRIGGER tr_log_nm_group_meeting_user_ids_meeting_user_t AFTER INSERT OR UPDATE OR DELETE ON nm_group_meeting_user_ids_meeting_user_t
FOR EACH ROW EXECUTE FUNCTION log_modified_related_models('group','group_id','meeting_user_ids','meeting_user','meeting_user_id','group_ids');

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the PL/pgSQL function log_modified_related_models and the tr_log_nm_group_meeting_user_ids_meeting_user_t trigger on nm_group_meeting_user_ids_meeting_user_t. Reproduce the DELETE of meeting_user/1 described in the issue and inspect how DELETE-related notifications are recorded. Done means the obsolete delete entry for the removed instance is no longer generated while the valid related-model updates remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.