[Django] #20656: test db not created when using new postgis 2.0 "CREATE EXTENSION postgis; " method

46 views
Skip to first unread message

Django

unread,
Jun 25, 2013, 10:55:29 PM6/25/13
to django-...@googlegroups.com
#20656: test db not created when using new postgis 2.0 "CREATE EXTENSION postgis;"
method
-------------------------------+--------------------
Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Following the directions here:

https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/postgis/#creating-a
-spatial-database-with-postgis-2-0-and-postgresql-9-1

I created my database using the new "CREATE EXTENSION postgis;" method and
then attempted to run tests using the standard, manage.py test, but it
appears that test does not properly add the necessary postgis extensions
and errors with:


{{{
DatabaseError: type "geometry" does not exist
LINE 7: "center" geometry(POINT,3122),
}}}

In addition, I attempted to define the POSTGIS_VERSION in my settings.py
file thinking this might just be undocumented, but even after adding this,
the same error above is still seen.

https://docs.djangoproject.com/en/1.5/ref/contrib/gis/testing/#postgis-
version


I guess the work around is to revert to using the create postgis template
method.

It would be nice if testing was supported when the "CREATE EXTENTSION"
method is used, but if not supported, at least update the docs to mention
testing can't be done when this method is used.

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

Django

unread,
Jun 25, 2013, 11:04:49 PM6/25/13
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------

Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by anonymous):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:1>

Django

unread,
Jun 26, 2013, 6:41:49 AM6/26/13
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+------------------------------------

Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: new
Component: GIS | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by ramiro):

* component: Uncategorized => GIS
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:2>

Django

unread,
Jun 26, 2013, 8:02:44 AM6/26/13
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+------------------------------------

Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: new
Component: GIS | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by anonymous):

#19152 was supposed to fix this issue. I have no such setup at hand
currently, but it should be nice to understand why that fix failed
somewhere.

--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:3>

Django

unread,
Jun 26, 2013, 11:05:33 AM6/26/13
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+------------------------------------

Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: new
Component: GIS | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by akaariai):

Did you also run `CREATE EXTENSION postgis_topology;`? I remember that
error message, IIRC the reason was not creating the postgis_topology
extension, or maybe is was having a template database for PostGIS 1.5. The
latter case is easy to check - if you have postgis template, rename it so
that Django won't see it.

--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:4>

Django

unread,
Jun 26, 2013, 10:27:41 PM6/26/13
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------

Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by monkut):

* component: GIS => Uncategorized
* stage: Accepted => Unreviewed


Comment:

no, "CREATE EXTENSION postgis_topology;" was not run on the initial
database.

--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:5>

Django

unread,
Jun 26, 2013, 10:34:53 PM6/26/13
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------

Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by monkut):

just browsed
https://github.com/django/django/commit/fbd1df8e16fc17a5d73f36136298c20b8ec3d618
mentioned in #19152, I don't remember if it's required, but the CREATE
extension statement appears to be missing a ";" (semicolon).


{{{
cursor.execute("CREATE EXTENSION postgis")
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:6>

Django

unread,
Jun 27, 2013, 10:24:08 AM6/27/13
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------
Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.5
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by fcurella):

* status: new => closed
* resolution: => needsinfo


Comment:

Hi Monkut,

I just tried creating a simple project, and my tests run fine.

I've created my database using:

{{{
$ createdb mydb
$ psql mydb
psql (9.2.2)
Type "help" for help.

mydb=# CREATE EXTENSION postgis;
CREATE EXTENSION
}}}

I've tested using `manage.py test myapp` on Django 1.5 and Django Trunk
(commit 99b467f272da9). For future reference, my Postgresql version was
9.2.2 and POSTGIS was 2.0.2.

--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:7>

Django

unread,
Jun 27, 2013, 10:25:46 AM6/27/13
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------
Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: closed
Component: GIS | Version: 1.5
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by fcurella):

* component: Uncategorized => GIS


--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:8>

Django

unread,
Jun 28, 2013, 2:29:09 AM6/28/13
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------
Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.5
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by monkut):

* component: GIS => Uncategorized


Comment:

ok, it's probably an error on my part. I've already migrated back to the
template method, but if I hit the problem again I'll try to get more
details.

Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:9>

Django

unread,
Jul 3, 2013, 11:23:23 AM7/3/13
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------
Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.5
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by fcurella):

* cc: flavio.curella@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:10>

Django

unread,
Jan 23, 2014, 5:20:07 PM1/23/14
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------
Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.4-beta-1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by GzVjAt):

* version: 1.5 => 1.4-beta-1


Comment:

<a href=http://silvertoncustomhomes.com/lib/#ybc3o>buy soma</a> generic
form of soma - www.soma bras

--
Ticket URL: <https://code.djangoproject.com/ticket/20656#comment:11>

Django

unread,
Feb 2, 2014, 9:02:04 PM2/2/14
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------
Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.4-rc-1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by VxBaHimeodGwCJmBM):

* version: 1.5 => 1.4-rc-1


Comment:

<a href=http://reglenna.com/doc/#kgx>external link</a> ativan 2mg tablet -
side effects of ativan during pregnancy

Django

unread,
Feb 3, 2014, 11:34:04 PM2/3/14
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+---------------------------------------
Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.7-alpha-1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------------
Changes (by afcxFDIPFhwpuilxa):

* version: 1.5 => 1.7-alpha-1


Comment:

<a href=http://reglenna.com/doc/#tepu9r>More about the author</a> ativan
1.5 mg - ativan withdrawal time period

Django

unread,
Feb 22, 2014, 10:39:48 PM2/22/14
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------
Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.5-rc-1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by FMyfjpku):

* version: 1.5 => 1.5-rc-1


Comment:

<a href=http://www.andresramirezgaviria.com/file/#x07mph>generic
provigil</a> buy provigil online uk - provigil daily dosage

Django

unread,
Oct 27, 2014, 6:02:02 PM10/27/14
to django-...@googlegroups.com
#20656: test db spatial extentsion not created when using new postgis 2.0 "CREATE
EXTENSION postgis;" method
-------------------------------+--------------------------------------
Reporter: monkut | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.5
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by timgraham):

I ran into this problem and fixed it by dropping the PostGIS template as
Anssi suggested in comment 4:
{{{
postgres=# UPDATE pg_database SET datistemplate='false' WHERE
datname='template_postgis';
UPDATE 1
postgres=# DROP DATABASE template_postgis;
DROP DATABASE
}}}

Reply all
Reply to author
Forward
0 new messages