0

Anyone ever seen this error? My migration is failing :(

django.db.utils.DatabaseError: function addgeometrycolumn(unknown, unknown, integer, unknown, integer) is not unique
LINE 1: SELECT AddGeometryColumn('maps_mapfeature', 'geom', 4326, 'M...
               ^
HINT:  Could not choose a best candidate function. You might need to add explicit type casts.

Here is the model

class MapFeature(models.Model):
    source = models.ForeignKey('MapLayer')
    label = models.CharField(max_length=255, blank=True)
    muni = models.CharField(max_length=255, blank=True)
    description = models.TextField(blank=True)
    geom = models.MultiPolygonField(srid=4326)
    objects = models.GeoManager()

    def __unicode__(self):
        return self.label
a.m.
  • 2,108
  • 5
  • 24
  • 29
  • 1
    Posting more details about the migration may be useful. How did the model look before? What should the migration change? – Gonzalo Dec 08 '12 at 00:02
  • you might have to do an explicit cast like this: `AddGeometryColumn(cast('maps_mapfeature' AS varchar), cast('geom' AS varchar), 4326, ...)` – karthikr Dec 08 '12 at 07:50
  • So I think I narrowed it down. I dumped a PostGIS2 db into a Db with postgis1.5 and now I'm trying to run Postgis1.5 commands on a postgis2 db. Postgis seems to have changed quite a bit from 1.5 - 2. Oh and FYI django 1.4 officially doesnt support postgis2.Thanks for the suggestions. – a.m. Dec 08 '12 at 16:40

0 Answers0