Opened 5 years ago

Closed 5 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:
Needs tests: Patch needs improvement:
Easy pickings: UI/UX:

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)

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

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by drdaeman

comment:1 Changed 5 years ago by jbronn

  • Resolution set to fixed
  • Status changed from new to closed

(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