Opened 6 years ago

Closed 6 years ago

#27072 closed Bug (fixed)

AddGeometryColumn: “duplicate column name: xxx” error running migrations on SpatiaLite

Reported by: Alex Rothberg Owned by: nobody
Component: GIS Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This is a repost of SO question. The issue still seems to occur in Django 1.9 when using the built in migrations.

For example, when running tests I see (I have a column named capture_location of type PointField):

Creating test database for alias 'default'...
AddGeometryColumn: "duplicate column name: capture_location"
... repeated many times
AddGeometryColumn: "duplicate column name: capture_location"
Destroying test database for alias 'default'...

(note that tests and server run without a problem)

Change History (5)

comment:1 Changed 6 years ago by Tim Graham

Component: UncategorizedGIS
Type: UncategorizedBug

I'm not sure the cause or resolution, but that error output also happens when running Django's test suite on SpatiaLite: $ ./tests/runtests.py gis_tests.gis_migrations.

comment:2 Changed 6 years ago by Tim Graham

Has patch: set
Summary: geodjango with migrations causes “duplicate collumn name error” with spatialight dbAddGeometryColumn: “duplicate column name: xxx” error running migrations on SpatiaLite
Triage Stage: UnreviewedAccepted

A little research suggests SELECT RecoverGeometryColumn should be used to recreate the geometry-ness of a column that had its geometry data discarded. My PR fixes the errors that are displayed while running Django's test suite. Can you check the patch with your project? I'm not sure if additional tests are required.

comment:3 Changed 6 years ago by Alex Rothberg

yes, this fixed the issue I was observing.

comment:4 Changed 6 years ago by Claude Paroz

Triage Stage: AcceptedReady for checkin

comment:5 Changed 6 years ago by GitHub <noreply@…>

Resolution: fixed
Status: newclosed

In 953629b:

Fixed #27072 -- Fixed AddGeometryColumn error when altering a SpatiaLite table.

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