Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#22334 closed Bug (worksforme)

Postgis version check discards dev versions

Reported by: xowap Owned by: nobody
Component: GIS Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

After installing a dev version of Postgis, I noticed that my Django app started to throw django.core.exceptions.ImproperlyConfigured: Cannot determine PostGIS version for database "gmp". GeoDjango requires at least PostGIS version 1.3. Was the database created from a spatial database template?

Actually the version check regular expression did only accept regular version numbers (like 2.1.0) but not development version numbers (2.2.0dev).

Change History (8)

comment:1 Changed 3 years ago by xowap

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:2 Changed 3 years ago by Erik Romijn

Component: UncategorizedGIS
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

This seems sensible to me, the only thing that is missing is a test for the newly supported behaviour. Could you add that to your PR?

comment:3 Changed 3 years ago by xowap

Sure I will do.

I looked into it, however I could not find a proper place to put them. Would you have a recommendation to make on this subject?

comment:4 Changed 3 years ago by Claude Paroz

Indeed. Feel free to create a new django/contrib/gis/tests/tests.py file.

comment:5 Changed 3 years ago by anonymous

Hum, this is embarrassing: while writing the tests, I discovered that I could not reproduce the bug on the unpatched code. Indeed, there is no $ at the end of the regexp.

I have no idea of how writing this patch turned the DB connection from "not working" to "working", but it wasn't probably correlated that much.

However, I wrote and pushed some unit tests, in case you want to keep them anyway.

comment:6 Changed 3 years ago by Claude Paroz <claude@…>

In 88f1e3d93d8f48a302ff75b1936e471c4a52fff9:

Unit testing Postgis version check

Refs #22334.

comment:7 Changed 3 years ago by Claude Paroz

Resolution: worksforme
Status: newclosed

Thanks for the tests!

comment:8 Changed 3 years ago by Claude Paroz <claude@…>

In e819a3cd622fe9404b1f5ea7891906c4cdabbb12:

Skipped PostGIS version tests when psycopg2 not installed

Refs #22334. Thanks Tim Graham for spotting the issue.

Note: See TracTickets for help on using tickets.
Back to Top