A Sequence can be created which will auto increment the value of rank column.
CREATE SEQUENCE rank_id_seq;
CREATE TABLE yourtable (
rank INTEGER NOT NULL default nextval('rank_id_seq'),
username VARCHAR(20) NOT NULL,
password VARCHAR(50) NOT NULL
);
ALTER SEQUENCE rank_id_seq owned by yourtable.rank;