I've had lots of responses to this, and I think I have it sussed now. Ifanyone has the same problem, the answer is:
Use the SERIAL type!
http://www.postgresql.org/docs/postgres/datatype.htm#AEN949