Bug report #16446

Many-to-many (N:M) relationship not working on simple case

Added by Nicolas Boisteault over 7 years ago. Updated almost 6 years ago.

Status:Closed
Priority:Normal
Assignee:Matthias Kuhn
Category:Relations
Affected QGIS version:3.3(master) Regression?:No
Operating System:Windows 7 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:24355

Description

Hi,
I can't make N:M relation working.
In attachment you'll find a small SQL script to create simple tables with restrictions as described here : https://github.com/qgis/QGIS/pull/2522
and a small QGIS project.
There are two issues :
When I create an observation, I can't create an author (auteur) linked to it
When I create an observation, I can't make a relation to an existing author (auteur). There is an error message because the new observation's id is not inserted in the relation table but a null value is inserted which violates not-null constraint.

many-to-many-bug_-_Copie.qgs (17.8 KB) Nicolas Boisteault, 2017-04-13 02:00 AM

many-to-many-tables.sql (1.36 KB) Nicolas Boisteault, 2017-04-13 02:00 AM

Associated revisions

Revision 686d2111
Added by Matthias Kuhn almost 6 years ago

Fix n:m relations in autogenerated attribute forms

Fix #16446
Fix #21491

Revision 99a01676
Added by Matthias Kuhn almost 6 years ago

Fix n:m relations in autogenerated attribute forms

Fix #16446
Fix #21491

Revision 9bf34104
Added by Matthias Kuhn almost 6 years ago

Fix n:m relations in autogenerated attribute forms

Fix #16446
Fix #21491

History

#1 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#2 Updated by Giovanni Manghi over 7 years ago

  • Description updated (diff)
  • Priority changed from High to Normal

#3 Updated by Regis Haubourg over 7 years ago

I tested that and it works for me though selecting rows is not so easy to understand.
In your dataset, the issue is probably that it is empty and that the current table form view shows an empty form, but to actually create a new observation, you need to use the 'add new line" button.

I can share a screen cast if needed

#4 Updated by Nicolas Boisteault over 7 years ago

When you say "add new line", you mean "add an entity", right?
Please make a screen cast, I really don't understand what I'm doing wrong.
Thank you very much.

#5 Updated by Nicolas Boisteault almost 7 years ago

I still can't create N:M relations in QGIS 3.0. Can someone give a simple example that works please ? Thanks.

#6 Updated by Giovanni Manghi almost 7 years ago

  • Status changed from Open to Feedback

#7 Updated by Regis Haubourg over 6 years ago

  • Status changed from Feedback to Open

#8 Updated by Nicolas Boisteault about 6 years ago

I still can't create N:M relations in QGIS 3.3.

#9 Updated by Giovanni Manghi about 6 years ago

  • Affected QGIS version changed from 2.18.5 to 3.3(master)

#10 Updated by Anonymous almost 6 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF