Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23416 closed Bug (fixed)

Django 1.7 fails to output a CHECK constraint on PositiveIntegerFields using postgres backend

Reported by: ris Owned by: nobody
Component: Database layer (models, ORM) Version: 1.7
Severity: Release blocker Keywords: postgres check constraint positiveintegerfield
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As title says.

In models.py:

    maximum_percentage = models.PositiveIntegerField ( null = True , blank = True )

sqlall line from django 1.6:

    "maximum_percentage" integer CHECK ("maximum_percentage" >= 0),

sqlall line from django 1.7:

    "maximum_percentage" integer,

Change History (5)

comment:1 by Baptiste Mispelon, 10 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

Confirmed and traced it back to d22b291890c1736a40c0ad97448c7318df2eebb2 using git bisect.

Thanks!

comment:2 by Marc Tamlyn, 10 years ago

Added a PR https://github.com/django/django/pull/3161

It is worth noting that if you are using migrations this will not happen.

comment:3 by Tim Graham, 10 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

comment:4 by Marc Tamlyn <marc.tamlyn@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 14c8456ffe7e6388383e6fe5c3f51cd20810ea49:

Fixed #23416 -- Make sure DatabaseCreation respects checks.

Migrations respected Field.db_parameters()check, but
DatabaseCreation was still using just Field.db_type().

comment:5 by Marc Tamlyn <marc.tamlyn@…>, 10 years ago

In 48e10710074a06584b6f8331a6e74492be5acf18:

[1.7.x] Fixed #23416 -- Make sure DatabaseCreation respects checks.

Migrations respected Field.db_parameters()check, but
DatabaseCreation was still using just Field.db_type().

Backport of 14c8456 from master

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