Changes between Initial Version and Version 3 of Ticket #25638


Ignore:
Timestamp:
Oct 30, 2015, 1:38:53 PM (9 years ago)
Author:
Tim Graham
Comment:

No trouble with this either:

def test_concat_update(self):
    author = Author.objects.create(name='Jὀy')
    Author.objects.update(name=Concat('name', Value('eὀd')))
    author.refresh_from_db()
    self.assertEqual(author.name, 'Jὀyeὀd')

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25638 – Description

    initial v3  
    11Suppose we want to concat a string to the end of a Charfield.
    22If we use:
    3   Model.objects.update(field=Concat('field', Value("end")))
    4 
     3{{{
     4  Model.objects.update(field=Concat('field', Value("end")))`
     5}}}
    56it will commit successfully, but the field will inlcude error-encoding text in SQLite. If we select the field from db, db will say "OperationalError: Could not decode to UTF-8 column 'name' with text".
    67
    78Instead,
     9{{{
    810  Model.objects.update(field=Concat('field', Value("end"), None))
     11}}}
    912it will be OK.
Back to Top