#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-------------------------------------+-------------------------------------
Reporter: Adrian Garcia | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: postgres, | Triage Stage: Ready for
generatedfield, contains | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):
In [changeset:"d8116bf7f56930a95926444c625ca786f2f534ce" d8116bf7]:
{{{#!CommitTicketReference repository=""
revision="d8116bf7f56930a95926444c625ca786f2f534ce"
[5.1.x] Fixed #35625 -- Fixed a crash when adding a field with db_default
and check constraint.
This is the exact same issue as refs #30408 but for creating a model with
a
constraint containing % escapes instead of column addition. All of these
issues
stem from a lack of SQL and parameters separation from the BaseConstraint
DDL
generating methods preventing them from being mixed with other parts of
the
schema alteration logic that do make use of parametrization on some
backends
(e.g. Postgres, MySQL for DEFAULT).
Prior to the addition of Field.db_default and GeneratedField in 5.0
parametrization of DDL was never exercised on model creation so this is
effectively a bug with db_default as the GeneratedField case was addressed
by
refs #35336.
Thanks Julien Chaumont for the report and Mariusz Felisiak for the review.
Backport of f359990e4909db8722820849d61a6f5724338723 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35336#comment:16>
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070190e872ff3d-83e35d52-2586-4bf1-be78-0a73b44b3c59-000000%40eu-central-1.amazonses.com.