Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does Postgres Support Autonumbers?

Status
Not open for further replies.

vz

MIS
Jul 31, 2001
131
0
0
US
I just ported over a db from access and I am having problems wiht a table that has an autonumber. How do you know if its supported or not and if its chosen to be an autonumber?
Thanks
 
PostgreSQL uses a different concept to handle this problem: sequences. Sequences are more powerful than a simple autonumber, because you can make a sequence of numerical increment, such incrementing by 2 for each record.

has a list of the SQL commands for PostgreSQL, and CREATE SEQUENCE is about halfway down on the list.

Actually, I just found that there is another datatype called "serial" that might accomplish this also. See and look for references to the Serial datatype.
 
Do you or anyone know how this is done? When u port over a database do u know if the sequence is automatically created? If not should I do this before or after I port?
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top