#24795: Migrations fail to apply with postgis 2.0 on remote database
----------------------------+--------------------
     Reporter:  zejn        |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  GIS         |    Version:  1.8
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  1
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 Hi,

 Problem lies here:
 
https://github.com/django/django/blob/1.8.1/django/contrib/gis/db/backends/postgis/base.py

 Beginning with 1.8, the logic to prepare database for test setup has been
 refactored and the prepare_database() now runs before any migration, not
 only before tests. This is important, because this now runs even in
 production.

 Since 1.8 supports both Postgis 1.5 and 2.0, the code tries to access the
 default database, with PostgreSQL this is "postgres" to check the postgis
 1.5 template database, specified in POSTGIS_TEMPLATE, actually exists.

 I have a production setup using PostgreSQL with Postgis 2.0 on a separate
 database server. The only accessible database (in pg_hba.conf) for my
 database user is the database the Django uses. Since code tries to access
 the database the user does not have access to (postgres), the whole
 migration process fails.

 See
 
https://github.com/django/django/commit/bac7664f274be834a09e037331889959f04a75e7
 for the relevant changes.

 The bug isn't present in master, because the failing query is only used
 for Postgis 1.5, which is not supported anymore in master, see
 https://github.com/zejn/django/commit/26996e2d55719deb0a0b85c642c88658c929106c

 I came up with a simple solution, but it's a bit implicit, see
 https://github.com/zejn/django/commit/acf81f0fe30bff8aa709e37ea10cf63061db4fbc

 For the time being I've patched Django.

--
Ticket URL: <https://code.djangoproject.com/ticket/24795>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/047.cb3e39812215d8015134c0170a022c2d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to