How to increase (Object ID) PostgreSQL Auto Increment (xx_xx_pkey) manually?

I'm using django and postgresql. I tried to generate data with Copy (sql).

Django does the auto increment of id. Presumably, the bi id value is kept in a table. I can't figure out which table this is. I want to update it manually.

I get the error in the following way.

IntegrityError: duplicate key value violates unique constraint 
"conversations_message_pkey"
DETAIL: Key (id) = (153226) already exists.

I think the conversations_message_pkey value is in a table in pg_catalog.

Upvotes: 0

Views: 184

Answers (1)

Jasen
Jasen

Reputation: 12412

conversations_message_pkey is most likely the unique index that enforces the primary key on the table conversations_message

if it's a serial column:

 select setval('conversations_message_id_seq'::regclass,max(id),True) from conversations_message;

Upvotes: 1

Related Questions