Opened 9 years ago

Closed 9 years ago

#12468 closed (fixed)

postgis backend has dummy return_insert_id(), making INSERTs fail.

Reported by: drdaeman Owned by: nobody
Component: GIS Version: master
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


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/", 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 ./ syncdb works).

Attachments (1)

postgis_psycopg2_database_operations.patch (709 bytes) - added by drdaeman 9 years ago.

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by drdaeman

comment:1 Changed 9 years ago by jbronn

Resolution: fixed
Status: newclosed

(In [12033]) Fixed #12468 -- Use the DatabaseOperations class from the postgresql_psycopg2 backend as the base class for PostGISOperations. Thanks, drdaeman, for bug report and patch.

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