Ticket#33647 : bulk_update silently truncating values for size limited 
fields <https://code.djangoproject.com/ticket/33647>

*Approach 1:*
As mentioned by Simon in this comment 
<https://code.djangoproject.com/ticket/33647#comment:3> we can introduce a 
new argument maybe named  generic in the database function Cast similar to 
the following
Cast(expr, ArrayField(CharField(max_length=20), generic=True).
Although as mentioned by Mariusz in this comment 
<https://github.com/django/django/pull/17366#issuecomment-1763440668> "we 
cannot introduce new keyword arguments into database function that will be 
only be used to fix usage elsewhere in the Django code."
But the explanation is still a little unclear to me, it would be great if 
someone can explain the reason.

*Approach 2:*
As we will not be able to introduce a new new keyword arguments into 
database function we can create a new database function named something 
like GenericCast,That will cast according to the type only without 
specifying the maximum length.
And we will use this to the only line causing this regression in 
bulk_update, i.e 
: 
https://github.com/django/django/blob/a1e4e86f923dc8387b0a9c3025bdd5d096a6ebb8/django/db/models/query.py#L765
 
.

I would like to move forward with the Approach 2. Some feedback would be 
great.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/b338adc5-78ce-4a78-8fe2-d7f5d5b17cban%40googlegroups.com.

Reply via email to