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

Cannot add a polymorphic relations #41959

Closed
troopa81 opened this issue Mar 2, 2021 · 8 comments · Fixed by #43488
Closed

Cannot add a polymorphic relations #41959

troopa81 opened this issue Mar 2, 2021 · 8 comments · Fixed by #43488
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Relations

Comments

@troopa81
Copy link
Contributor

troopa81 commented Mar 2, 2021

Describe the bug

Nothing happen when I try to create a Polymorphic Relation with the given project

How to Reproduce

  1. Create PostGIS database and intialize it with the following instructions
# poly_relations
create table docs ( id serial primary key , filepath  varchar ); 

insert into docs (filepath) values ('pipe_photo1.jpg');
insert into docs (filepath) values ('pipe_photo2.jpg');
insert into docs (filepath) values ('pipe_manual.pdf');
insert into docs (filepath) values ('manhole_photo1.jpg');
insert into docs (filepath) values ('manhole_photo2.jpg');
insert into docs (filepath) values ('manhole_manual.pdf');
insert into docs (filepath) values ('manhole_model.dwg');

create table pipe (  id serial primary key, name varchar );
insert into pipe (name) values ('nom d une pipe');
insert into pipe (name) values ('ceci n est pas une pipe');

create table manhole (  idmh serial primary key, name varchar ); 
insert into manhole (name) values('manhole1');
insert into manhole (name) values('manhole2');

create table obj2doc ( idobj integer, objtable varchar, iddoc integer, 
CONSTRAINT fk_doc  FOREIGN KEY(iddoc) REFERENCES docs(id));

insert into obj2doc values ( 1, 'pipe', 1 );
insert into obj2doc values ( 1, 'pipe', 3 );
insert into obj2doc values ( 2, 'pipe', 2 );
insert into obj2doc values ( 2, 'pipe', 3 );
insert into obj2doc values ( 1, 'manhole', 4 );
insert into obj2doc values ( 1, 'manhole', 6 );
insert into obj2doc values ( 2, 'manhole', 7 );
insert into obj2doc values ( 2, 'manhole', 5 );
insert into obj2doc values ( 2, 'manhole', 6 );
  1. Open the following project poly_relations.tar.gz
  2. Try to add a polymorphic relation with the following configuration parameters
    polyrelations
  3. Select OK
  4. No relations has been added

QGIS and OS versions

Debian bullseye
QGIS a90e3e349a

Additional context

@troopa81 troopa81 added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Mar 2, 2021
@gioman gioman added the Feedback Waiting on the submitter for answers label Mar 2, 2021
@gioman
Copy link
Contributor

gioman commented Mar 2, 2021

@troopa81 is this a regression or is just a functionality that never worked as expected?

@troopa81
Copy link
Contributor Author

troopa81 commented Mar 2, 2021

@troopa81 is this a regression or is just a functionality that never worked as expected?

More the second, polymorphic relation is a new feature that appears in 3.18 I think

@gioman
Copy link
Contributor

gioman commented Mar 2, 2021

More the second, polymorphic relation is a new feature that appears in 3.18 I think

@troopa81 do you remember who developed this? I don't remember and can't find now.

@gioman gioman removed the Feedback Waiting on the submitter for answers label Mar 2, 2021
@troopa81
Copy link
Contributor Author

troopa81 commented Mar 2, 2021

The feature was brought essentially by these two PRs #40914 and #41009

@gioman
Copy link
Contributor

gioman commented Mar 2, 2021

The feature was brought essentially by these two PRs #40914 and #41009

@suricactus ping

@suricactus
Copy link
Contributor

suricactus commented Mar 2, 2021

Earlier today I have observed similar thing on 3.18, but not on master. I will have look now.

@suricactus
Copy link
Contributor

Okay, here the problem is that the manhole layer does not have id column, but idmh. I will open a PR where this kind of feedback is being shown to the user.

@3nids 3nids self-assigned this Jun 1, 2021
3nids added a commit to 3nids/QGIS that referenced this issue Jun 1, 2021
…elations

only offer the fields that are across all the referenced layers

fixes qgis#41959
@troopa81
Copy link
Contributor Author

troopa81 commented Jun 2, 2021

Thanks @3nids

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! Relations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants