Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have started to learn pgAdmin III to manage a PostgreSQL database. But it wasn't an easy to use application.

If I create or have created a table with pgAdmin III, how can I add "auto-increment"-functionality on a column id that has type integer?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

two options: Use the "datatype" SERIAL or create a sequence and use this sequence as a default value for your integer:

  id int default nextval('your_seq'::regclass),
  other_column TEXT
INSERT INTO foo(other_column) VALUES ('bar') RETURNING *;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.