[Answer]-Django datetime primary key doesn't constrain unique

0👍

Ricola3D linked me to the same question (that’s answered) that explains my problem.

Answered Question

1👍

Maybe the example from the docs can bring some light into your question

Technically, a primary key constraint is simply a combination of a
unique constraint and a not-null constraint. So, the following two
table definitions accept the same data:

CREATE TABLE products (
  product_no integer UNIQUE NOT NULL,
  name text,
  price numeric );

CREATE TABLE products (
  product_no integer PRIMARY KEY,
  name text,
  price numeric );

[…] A primary key indicates that a column or group of columns can be
used as a unique identifier for rows in the table […] Adding a
primary key will automatically create a unique btree index on the
column or group of columns used in the primary key. […]

Leave a comment