I've got a test application created in Java for creating an indexed and non indexed table inside a MySQL, PostgreSQL, Oracle and Firebird database (Among other activities).

Could it be just a situation that PostgreSQL does not permit the auto increment feature? Otherwise, what's the normal technique of getting an indexed coloumn?

Thanks ahead of time

You can utilize [cde] in PostgreSQL to create auto increment area,

For eg:-


This can create userid as auto-increment primary key indexed. If you do not want this as primary key, just remove PRIMARY KEY.

Make use of a column of type CREATE TABLE user ( userid SERIAL PRIMARY KEY, username VARCHAR(16) UNIQUE NOT NULL ) . It really works exactly the same way as SERIAL on another DBs. (Look into the paperwork for additional features you should use by using it.)

With current Postgres, you can easily use SERIAL for that column type.

With older versions of Postgres, you are able to implement this using SEQUENCE the appropriate procedure is:


A great article about this is MySQL versus PostgreSQL: Adding an Auto-Increment Column to a Table