#34944: Missing or misinferred attributes in output fields of generated fields
-------------------------------------+-------------------------------------
     Reporter:  Paolo Melchiorre     |                    Owner:  Om Dahale
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  5.0
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:  field, database,     |             Triage Stage:  Accepted
  generated, output_field            |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Paolo Melchiorre):

 Replying to [comment:5 David Sanders]:
 > Perhaps forum discussion is required ...

 I started a discussion in the forum:
 https://forum.djangoproject.com/t/release-blocker-missing-or-misinferred-
 attributes-in-output-fields-of-generated-fields/25103

 > ... I don't think we ought to go down the route of trying to make
 `resolve_expression()` smart enough to determine that concat'ing 2
 varchars means we need to add the max-lengths together ... 🤔

 In fact, in my proposal for the "Cumulative proposal", I excluded this
 hypothesis.

 > We definitely need to fix the broken "None" in the DDL 👍

 Yes, I think it absolutely needs to be resolved.

 > > Always require specifying the output field (except when you are sure
 that the extracted type cannot generate error situations?)
 >
 > Perhaps 👍  "Explicit is better than implicit" and all that, though I
 think that documenting "For complex expressions consider always declaring
 an output_field" is a nice option.

 It could be a good solution, but it should be highlighted that deriving
 the `output_field` from the expression could hide pitfalls even in
 apparently simple cases such as concatenating two `CharField` on `SQLite`.
 Not all Django developers look under the hood of the `ORM` or check the
 `SQL` code generated by migrations.

 Perhaps it might be safer to always require the user to specify an
 `output_field`.

 > I'm keen to hear Mariusz & Lily's thoughts.

 Me too, and also the people who collaborated on this feature like Simon,
 Lily, and Adam.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34944#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ba907df2a-56ad6686-93bc-4664-a88b-ddee5924e5f0-000000%40eu-central-1.amazonses.com.

Reply via email to