SQL auto increment pgadmin 4

The subject of the question mentions pgAdmin 4, so here’s how to do it there.

First, add a column to your table, then click the little edit icon:

enter image description here

Then go to Constraints and select the Identity type:

enter image description here

This generates SQL similar to this:

CREATE TABLE public.my_table_name
(
    id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
    PRIMARY KEY (id)
);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)