Sample Header Ad - 728x90

Postgres: How to insert row with autoincrement id

26 votes
3 answers
170384 views
There is a Table "context". There is an autoincrement id "context_id". I am using sequence to retrieve the next value. SELECT nextval('context_context_id_seq') The result is: 1, 2, 3,...20.... But there are 24780 rows in the "context" table How can I get the next value (24781)? I need to use it in the INSERT statement
Asked by user3631472 (361 rep)
May 22, 2014, 09:20 AM
Last activity: Apr 10, 2024, 07:53 PM