Skip to content

Instantly share code, notes, and snippets.

@denishpatel
Created August 26, 2020 11:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save denishpatel/89f8d8a48fe418fc16c36ea9b81168a5 to your computer and use it in GitHub Desktop.
postgres=# select * from identity_always;
id | name
----+------
1 | RJ
(1 row)
postgres=# alter table identity_always alter COLUMN id restart ;
ALTER TABLE
postgres=# insert into identity_always (name) values ('test');
ERROR: duplicate key value violates unique constraint "identity_always_pkey"
DETAIL: Key (id)=(1) already exists.
postgres=# truncate identity_always restart identity;
TRUNCATE TABLE
postgres=# insert into identity_always (name) values ('test');
INSERT 0 1
postgres=# select * from identity_always;
id | name
----+------
1 | test
(1 row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment