Relative Content

Tag Archive for postgresqlidentity

Serial or identity define with starting value as max(table)

I have a table with id, name columns id is integer with identity or serial, primary constraints
When I insert first record “id” Is auto generate(insert into tab1(name) values(‘test2’))with value 1 and second record inserting with “id” Column like insert into tab1(id, name) values(2, ‘test2’) again 3rd record insert with id auto generate and getting primary key violation error.