Opened 9 years ago

Closed 9 years ago

#24795 closed Bug (duplicate)

Migrations fail to apply with postgis 2.0 on remote database

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



Problem lies here:

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 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

I came up with a simple solution, but it's a bit implicit, see

For the time being I've patched Django.

Change History (1)

comment:1 by Claude Paroz, 9 years ago

Resolution: duplicate
Status: newclosed

This is a duplicate of #24791. Looks like this nodb_connection was not such a good idea.

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