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

PostGIS layer saved in 3.10 project, fail to load correctly on 3.14 #38567

Closed
SrNetoChan opened this issue Sep 2, 2020 · 3 comments · Fixed by #38763
Closed

PostGIS layer saved in 3.10 project, fail to load correctly on 3.14 #38567

SrNetoChan opened this issue Sep 2, 2020 · 3 comments · Fixed by #38763
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers High Priority Regression Something which used to work, but doesn't anymore

Comments

@SrNetoChan
Copy link
Member

SrNetoChan commented Sep 2, 2020

Describe the bug

When using postgis tables where the geometry type is not restricted geometry(Geometry,4326) , if you have used DBmanager in QGIS 3.10 to load the table in different geometry types and save the project, once you try to open the same project in QGIS 3.14, it will fail to load the layers. This is, in my opinion, a severe regression that can break lots of projects.

Besides, fixing the failing layers is almost impossible because the layers fro each geometry won't show on the browser unless the option Don't resolve type of unrestricted columns (GEOMETRY) in the connection is disabled AND there is at leas one feature of the wanted geometry type already.

How to Reproduce

  1. Create a table with an unrestricted geometry type
CREATE TABLE tests (
gid serial primary key,
geom geometry(Geometry, 4326)
);
  1. In QGIS 3.10 LTR, using DBManager, load the table for the 3 geometry types
  2. Save the project
  3. Load the project in QGIS 3.14, those layers should fail to load.

QGIS and OS versions

Additional context

@SrNetoChan SrNetoChan added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Sep 2, 2020
@elpaso
Copy link
Contributor

elpaso commented Sep 14, 2020

Can you please attach a sample project (with localhost connection is ok, I will edit the project to use my local connection if needed).

@elpaso elpaso self-assigned this Sep 14, 2020
@elpaso elpaso added the Feedback Waiting on the submitter for answers label Sep 14, 2020
@SrNetoChan
Copy link
Member Author

I will create one ASAP.

@SrNetoChan
Copy link
Member Author

@elpaso heres a project with that problem. It was created in QGIS 3.10.

The database is called gisdb, and you can create the table using:

CREATE TABLE tests (
gid serial primary key,
geom geometry(Geometry, 4326)
);

dbmanager_unrestricted_geom.zip

@elpaso elpaso added High Priority Regression Something which used to work, but doesn't anymore labels Sep 15, 2020
elpaso added a commit to elpaso/QGIS that referenced this issue Sep 15, 2020
Fixes qgis#38567 where the SRID was not detected if the table was empty.

Also: do not override the SRID passed explicitly in the data source
URI.

Note: the logic in the provider is becoming a bit convoluted, there
are too many corner cases, at least the test coverage is pretty
good.
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! Feedback Waiting on the submitter for answers High Priority Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants