﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26788	update of geometry field from the another one crashes	Sergey Fedoseev	Sergey Fedoseev	"{{{#!python
class City(models.Model):
    point = models.PointField(srid=4326)
    point2 = models.PointField(srid=3857, null=True)
}}}


{{{#!python
City.objects.update(point2=models.F('point'))
}}}

{{{#!python
<ipython-input-7-e6630ea1824e> in <module>()
----> 1 City.objects.update(point2=models.F('point'))

/home/sergey/dev/django/django/db/models/manager.pyc in manager_method(self, *args, **kwargs)
     83         def create_method(name, method):
     84             def manager_method(self, *args, **kwargs):
---> 85                 return getattr(self.get_queryset(), name)(*args, **kwargs)
     86             manager_method.__name__ = method.__name__
     87             manager_method.__doc__ = method.__doc__

/home/sergey/dev/django/django/db/models/query.pyc in update(self, **kwargs)
    634         query.add_update_values(kwargs)
    635         with transaction.atomic(using=self.db, savepoint=False):
--> 636             rows = query.get_compiler(self.db).execute_sql(CURSOR)
    637         self._result_cache = None
    638         return rows

/home/sergey/dev/django/django/db/models/sql/compiler.pyc in execute_sql(self, result_type)
   1146         related queries are not available.
   1147         """"""
-> 1148         cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
   1149         try:
   1150             rows = cursor.rowcount if cursor else 0

/home/sergey/dev/django/django/db/models/sql/compiler.pyc in execute_sql(self, result_type)
    822             result_type = NO_RESULTS
    823         try:
--> 824             sql, params = self.as_sql()
    825             if not sql:
    826                 raise EmptyResultSet

/home/sergey/dev/django/django/db/models/sql/compiler.pyc in as_sql(self)
   1114             # Getting the placeholder for the field.
   1115             if hasattr(field, 'get_placeholder'):
-> 1116                 placeholder = field.get_placeholder(val, self, self.connection)
   1117             else:
   1118                 placeholder = '%s'

/home/sergey/dev/django/django/contrib/gis/db/models/fields.pyc in get_placeholder(self, value, compiler, connection)
    159         given value.
    160         """"""
--> 161         return connection.ops.get_geom_placeholder(self, value, compiler)
    162 
    163     def get_srid(self, obj):

/home/sergey/dev/django/django/contrib/gis/db/backends/postgis/operations.pyc in get_geom_placeholder(self, f, value, compiler)
    338             value_srid = get_pgraster_srid(value)
    339         else:
--> 340             value_srid = value.srid
    341 
    342         # Adding Transform() to the SQL placeholder if the value srid

AttributeError: 'Col' object has no attribute 'srid'
}}}"	Bug	closed	GIS	1.9	Normal	fixed			Ready for checkin	1	0	0	0	0	0
