﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
5671	Change SQL generation when primary_key=True and unique=True	Nis Jørgensen <nis@…>	nobody	"At the moment, these two models, which are logically equivalent, generate different sql:

{{{

class Country(models.Model):
    isocode = CharField(max_length=3, primary_key=True, unique=True)
}}}

{{{


class Country(models.Model):
    isocode = CharField(max_length=3, primary_key=True)
}}}

- at least for backends other than Oracle

I would like to suggest that we do not create explicit UNIQUE constraints for (single field) primary keys.

On the other hand, I think it would be nice if field.unique returned True for a primary key field no matter if it was defined as such or not.

I will write a patch doing this, but am of course open to alternative suggestions."		closed	Database layer (models, ORM)	dev		fixed	db-be-api		Accepted	1	0	0	0	0	0
