Re: [Django] #35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or CheckConstraint

32 views
Skip to first unread message

Django

unread,
Jun 25, 2024, 10:15:44 AM6/25/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: generatedfield | Triage Stage:
uniqueconstraint checkconstraint | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mark Gensler):

* has_patch: 0 => 1
* owner: nobody => Mark Gensler
* status: new => assigned

Comment:

I've assigned this to myself as I'm happy to work on it. Will leave the
discussion to the PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 25, 2024, 10:56:18 AM6/25/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: generatedfield | Triage Stage:
uniqueconstraint checkconstraint | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mark Gensler):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:3>

Django

unread,
Jun 25, 2024, 4:11:10 PM6/25/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: generatedfield | Triage Stage: Accepted
uniqueconstraint checkconstraint |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* cc: Mariusz Felisiak, Lily Foote, Paolo Melchiorre (added)
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted

Comment:

Hello Mark Gensler, thank you for this ticket report! And big thanks for
the prompt PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:4>

Django

unread,
Jul 3, 2024, 5:10:36 AM7/3/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: generatedfield | Triage Stage: Ready for
uniqueconstraint checkconstraint | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:5>

Django

unread,
Jul 4, 2024, 5:45:24 AM7/4/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: generatedfield | Triage Stage: Ready for
uniqueconstraint checkconstraint | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"1005c2abd1ef0c156f449641e38c33e473989d37" 1005c2a]:
{{{#!CommitTicketReference repository=""
revision="1005c2abd1ef0c156f449641e38c33e473989d37"
Fixed #35560 -- Made Model.full_clean() ignore GeneratedFields for
constraints.

Accessing generated field values on unsaved models caused a crash when
validating CheckConstraints and UniqueConstraints with expressions.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:6>

Django

unread,
Jul 4, 2024, 5:48:01 AM7/4/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: generatedfield | Triage Stage: Ready for
uniqueconstraint checkconstraint | 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:"2da007737cda936ef2ee87271bf9e69eb93cd3fe" 2da00773]:
{{{#!CommitTicketReference repository=""
revision="2da007737cda936ef2ee87271bf9e69eb93cd3fe"
[5.1.x] Fixed #35560 -- Made Model.full_clean() ignore GeneratedFields for
constraints.

Accessing generated field values on unsaved models caused a crash when
validating CheckConstraints and UniqueConstraints with expressions.

Backport of 1005c2abd1ef0c156f449641e38c33e473989d37 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:7>

Django

unread,
Jul 4, 2024, 5:50:39 AM7/4/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: generatedfield | Triage Stage: Ready for
uniqueconstraint checkconstraint | 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:"0602fc2124f3e1f1562d497607e0efd5474b5831" 0602fc2]:
{{{#!CommitTicketReference repository=""
revision="0602fc2124f3e1f1562d497607e0efd5474b5831"
[5.0.x] Fixed #35560 -- Made Model.full_clean() ignore GeneratedFields for
constraints.

Accessing generated field values on unsaved models caused a crash when
validating CheckConstraints and UniqueConstraints with expressions.

Backport of 1005c2abd1ef0c156f449641e38c33e473989d37 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:8>

Django

unread,
Jul 8, 2024, 6:38:14 AM7/8/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: generatedfield | Triage Stage: Ready for
uniqueconstraint checkconstraint | 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:"c76089be6f955d0493b3ab81c2beb64db4e203c4" c76089b]:
{{{#!CommitTicketReference repository=""
revision="c76089be6f955d0493b3ab81c2beb64db4e203c4"
[5.0.x] Refs #35560 -- Corrected CheckConstraint argument name in
model_fields tests.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:9>

Django

unread,
Jul 15, 2024, 4:20:18 AM7/15/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: generatedfield | Triage Stage: Ready for
uniqueconstraint checkconstraint | 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:"2d3bb414cfb2778cc64f22e7203102d7389f81e6" 2d3bb414]:
{{{#!CommitTicketReference repository=""
revision="2d3bb414cfb2778cc64f22e7203102d7389f81e6"
Refs #35560 -- Corrected required feature flags in
GeneratedModelUniqueConstraint.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:10>

Django

unread,
Jul 15, 2024, 4:23:50 AM7/15/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: generatedfield | Triage Stage: Ready for
uniqueconstraint checkconstraint | 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:"ebcbf731538c7998d745a7b6fb2ee5c93d9fdb62" ebcbf731]:
{{{#!CommitTicketReference repository=""
revision="ebcbf731538c7998d745a7b6fb2ee5c93d9fdb62"
[5.1.x] Refs #35560 -- Corrected required feature flags in
GeneratedModelUniqueConstraint.

Backport of 2d3bb414cfb2778cc64f22e7203102d7389f81e6 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:11>

Django

unread,
Jul 15, 2024, 4:26:07 AM7/15/24
to django-...@googlegroups.com
#35560: Model.full_clean() errors with GeneratedField and UniqueConstraint or
CheckConstraint
-------------------------------------+-------------------------------------
Reporter: Mark Gensler | Owner: Mark
| Gensler
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: generatedfield | Triage Stage: Ready for
uniqueconstraint checkconstraint | 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:"c1028bdd0962cd2fdfdd966cd5c6243cb196d896" c1028bd]:
{{{#!CommitTicketReference repository=""
revision="c1028bdd0962cd2fdfdd966cd5c6243cb196d896"
[5.0.x] Refs #35560 -- Corrected required feature flags in
GeneratedModelUniqueConstraint.

Backport of 2d3bb414cfb2778cc64f22e7203102d7389f81e6 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35560#comment:12>
Reply all
Reply to author
Forward
0 new messages