Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composition relations: only the first relation is taken into account #55892

Closed
2 tasks done
Meibes opened this issue Jan 19, 2024 · 0 comments · Fixed by #55944
Closed
2 tasks done

composition relations: only the first relation is taken into account #55892

Meibes opened this issue Jan 19, 2024 · 0 comments · Fixed by #55944
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!

Comments

@Meibes
Copy link

Meibes commented Jan 19, 2024

What is the bug or the crash?

Hello,

I tried to use composition relations in my project using QGIS 3.34 and PostgreSQL 15 tables but it didn't work

my setup: several postgres tables, one with geometries, several others without, referencing the table with the geometries via foreign keys

my observation: for multiple composition relationships referencing the same parent, only the first composition is taken into account when duplicating/deleting an object from the parent layer.

2024-01-19_10-51-23_qgis_bug_report.mp4

in 3.28 compositions don't work at all
the nightly-dev build behaves exactly like 3.34

@nirvn could you take a look at it? it seems like you worked on compositions in the past #53965

Cheers

Steps to reproduce the issue

  1. create the following database:
CREATE EXTENSION IF NOT EXISTS "postgis";

CREATE TABLE IF NOT EXISTS parent(
  id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
  geom geometry(LineString, 4326) NOT NULL,
  description text
);

CREATE TABLE IF NOT EXISTS child_1(
  id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
  parent_id integer REFERENCES parent(id) ON DELETE CASCADE ON UPDATE CASCADE,
  description text
);

CREATE TABLE IF NOT EXISTS child_2(
  id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
  parent_id integer REFERENCES parent(id) ON DELETE CASCADE ON UPDATE CASCADE,
  description text
);

CREATE TABLE IF NOT EXISTS child_3(
  id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
  parent_id integer REFERENCES parent(id) ON DELETE CASCADE ON UPDATE CASCADE,
  description text
);

INSERT INTO parent (geom, description) VALUES ('LINESTRING(20.735 42.2126, 20.736 42.2127)', 'parent 1');
INSERT INTO parent (geom, description) VALUES ('LINESTRING(20.736 42.2127, 20.737 42.2128)', 'parent 2');
INSERT INTO parent (geom, description) VALUES ('LINESTRING(20.737 42.2128, 20.738 42.2129)', 'parent 3');

INSERT INTO child_1 (parent_id, description) VALUES (1, 'child 1');
INSERT INTO child_1 (parent_id, description) VALUES (2, 'child 2');
INSERT INTO child_1 (parent_id, description) VALUES (2, 'child 3');
INSERT INTO child_1 (parent_id, description) VALUES (3, 'child 4');
INSERT INTO child_1 (parent_id, description) VALUES (3, 'child 5');
INSERT INTO child_1 (parent_id, description) VALUES (3, 'child 6');

INSERT INTO child_2 (parent_id, description) VALUES (1, 'child a');
INSERT INTO child_2 (parent_id, description) VALUES (2, 'child b');
INSERT INTO child_2 (parent_id, description) VALUES (2, 'child c');
INSERT INTO child_2 (parent_id, description) VALUES (3, 'child d');
INSERT INTO child_2 (parent_id, description) VALUES (3, 'child e');
INSERT INTO child_2 (parent_id, description) VALUES (3, 'child f');

INSERT INTO child_3 (parent_id, description) VALUES (1, 'child i');
INSERT INTO child_3 (parent_id, description) VALUES (2, 'child ii');
INSERT INTO child_3 (parent_id, description) VALUES (2, 'child iii');
INSERT INTO child_3 (parent_id, description) VALUES (3, 'child iv');
INSERT INTO child_3 (parent_id, description) VALUES (3, 'child v');
INSERT INTO child_3 (parent_id, description) VALUES (3, 'child vi');
  1. start qgis
  2. load all layers from postgres
  3. Project -> Properties...
  4. Relations -> Add Relation
  5. relationship strength -> composition
  6. parent -> layer: parent field: id
  7. child -> layer: child_1 field: parent_id
  8. same procedure for child_2 and child_3
  9. set layer parent active
  10. toggle editing mode
  11. select existing feature(s)
  12. edit -> copy features
  13. edit -> paste features
  14. check notification / editing modes / attribute tables

Versions

QGIS version 3.34.2-Prizren QGIS code revision 7d19979
Qt version 5.15.3
Python version 3.9.5
Compiled against GDAL/OGR 3.8.2 Running against GDAL/OGR 3.8.3
PROJ version 9.3.1
EPSG Registry database version v10.098 (2023-11-24)
GEOS version 3.12.1-CAPI-1.18.1
SQLite version 3.41.1
PDAL version 2.6.0
PostgreSQL client version 15.2
SpatiaLite version 5.1.0
QWT version 6.1.6
QScintilla2 version 2.13.4
OS version Windows 10 Version 2009
       
Active Python plugins
alkisplugin 2.0.54
firstaid 3.0.3
gewaesserschau-main 0.1
gueasy_plugin 0.1
inspireatomclient 0.8.1
linking_relation_editor v1.2.0
nominatim_locator_filter 0.3.2
qfieldsync v4.7.0
volume_calculation_tool 0.4
db_manager 0.1.20
grassprovider 2.12.99
processing 2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

@Meibes Meibes added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 19, 2024
@nirvn nirvn self-assigned this Jan 23, 2024
nirvn added a commit to nirvn/QGIS that referenced this issue Jan 23, 2024
nirvn added a commit to nirvn/QGIS that referenced this issue Jan 23, 2024
lbartoletti pushed a commit that referenced this issue Jan 25, 2024
nirvn added a commit to nirvn/QGIS that referenced this issue Jan 28, 2024
nirvn added a commit to nirvn/QGIS that referenced this issue Jan 28, 2024
nyalldawson pushed a commit that referenced this issue Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
2 participants