I have searched a lot related concerning the serial
data type.
I had defined a table with one column as serial
. How do I set the start value for this column using pgAdmin?
Asked
Active
Viewed 5,408 times
2

Erwin Brandstetter
- 605,456
- 145
- 1,078
- 1,228

ameen
- 41
- 2
- 4
1 Answers
3
Note that serial
is a pseudo type. Details here:
Auto increment SQL function
Safely and cleanly rename tables that use serial primary key columns in Postgres?
Values come from an attached sequence. To start with a certain value, change the sequence:
ALTER SEQUENCE tbl_tbl_id_seq START 123;
In pgAdmin, select the sequence in the object browser, open the properties and set the current value:
By default, the next value retrieved will be the one after the value you set.

Community
- 1
- 1

Erwin Brandstetter
- 605,456
- 145
- 1,078
- 1,228