#34861: KeyTextTransform incompatible with GeneratedField
-------------------------------------+-------------------------------------
     Reporter:  Paolo Melchiorre     |                    Owner:  Paolo
                                     |  Melchiorre
         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:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Paolo Melchiorre):

 Replying to [comment:1 Simon Charette]:
 > The issue lies in `GeneratedField.generated_sql`, it should not call
 `as_sql` directly as it doesn't account for `{vendor}_sql` overrides.
 >
 > It should
 
[https://github.com/django/django/blob/78b5c9075348aa12da2e024f6ece29d1d652dfdd/django/db/models/sql/compiler.py#L541-L547
 let the compiler compile the expression instead], something like

 Thanks, Simon, I used the code you suggested and confirm that it solves
 the problem.

 I tested the patch locally on my PC with both SQLite and PostgreSQL.

 I submitted a commit with the fix where I added you as a co-author and
 tried to add an explicit test on the generated SQL code.

 Here you can find my PR https://github.com/django/django/pull/17301

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34861#comment:3>
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/0107018abc089c83-4312ea39-ef86-42f8-991e-826049c5ffe8-000000%40eu-central-1.amazonses.com.

Reply via email to