Opened 16 years ago
Closed 16 years ago
#12468 closed (fixed)
postgis backend has dummy return_insert_id(), making INSERTs fail.
| Reported by: | drdaeman | Owned by: | nobody |
|---|---|---|---|
| Component: | GIS | Version: | dev |
| Severity: | Keywords: | postgis db backend insert | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Because django.db.backends.postgresql.operations.DatabaseOperations has no proper return_insert_id(), but postgis imports Database from django.db.backends.postgresql_psycopg2.base and connection.ops has this feature, syncdb (and, probably, any INSERT, as this happened when syncdb tried to populate content-types table) fails with:
File ".../django/django/db/models/sql/compiler.py", line 724, in as_sql
r_fmt, r_params = self.connection.ops.return_insert_id()
TypeError: 'NoneType' object is not iterable
The reason for error is that return_insert_id() is just a pass dummy, returning None.
If my understanding is right, the attached patch to django.contrib.gis.db.backends.postgis.operations should fix the problem (at least, now ./manage.py syncdb works).
Attachments (1)
Change History (2)
by , 16 years ago
| Attachment: | postgis_psycopg2_database_operations.patch added |
|---|
comment:1 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
(In [12033]) Fixed #12468 -- Use the
DatabaseOperationsclass from thepostgresql_psycopg2backend as the base class forPostGISOperations. Thanks, drdaeman, for bug report and patch.