R
R
Ruslan Absalyamov2018-08-06 15:54:44
PostgreSQL
Ruslan Absalyamov, 2018-08-06 15:54:44

Why doesn't my primary key work?

I don’t understand a little why the primary key doesn’t work for me and it goes constantly as a null value.
Here is a screenshot
5b6844f46d99b406799717.png5b6844fc4eb4d065188456.png
It seems that it should increase?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bkosun, 2018-08-06
@rusline18

PostgreSQL has smallserial, serial and bigserial data types. They are for creating unique identity columns. This is analogous to the AUTO_INCREMENT property found in some other databases.
You are using BIGINT type, replace with BIGSERIAL.
Simple example:

CREATE TABLE books (
  id              SERIAL PRIMARY KEY,
  title           VARCHAR(100) NOT NULL,
  primary_author  VARCHAR(100) NULL
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question