Opened 3 weeks ago

Closed 3 weeks ago

#36808 closed Cleanup/optimization (fixed)

Make UniqueConstraint name required in signature

Reported by: Jonathan Biemond Owned by: Jonathan Biemond
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Jonathan Biemond Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

A UniqueConstraint requires a name argument, but is declared optional (=None) in its signature. If name is omitted a ValueError is raised. This may be confusing to developers.

The name argument was first made optional in the signature in commit [3aa545281], which introduced support for functional unique constraints, addressing ticket #30016.

More discussion on the forum: https://forum.djangoproject.com/t/make-uniqueconstraint-name-required-in-signature/43664

Change History (4)

comment:1 by Jonathan Biemond, 3 weeks ago

Has patch: set

comment:2 by Jacob Walls, 3 weeks ago

Triage Stage: UnreviewedAccepted
Version: 6.0dev

Thanks. #36262 is a related ticket as Clifford pointed out on the forum.

comment:3 by Jacob Walls, 3 weeks ago

Triage Stage: AcceptedReady for checkin

comment:4 by Jacob Walls <jacobtylerwalls@…>, 3 weeks ago

Resolution: fixed
Status: assignedclosed

In b172cbd:

Fixed #36808 -- Required name argument in UniqueConstraint signature.

By trading ValueError for TypeError for omitted name arguments,
we gain a little clarity.

Note: See TracTickets for help on using tickets.
Back to Top