I have a Webmail app that uses a database backend for its address book, task list, calendar etc. Currently it runs against MySQL and uses MySQL's non ANSI standard AUTO INCREMENT feature to generate the sequence for the id column primary key:
CREATE TABLE address_book (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id) )
There are of course a number of ways of generating a unique primary key like CREATE SEQUENCE. What I would like is suggestions of the most portable way short of creating a table called primary_keys with columns for the tables that hold the next primary key for each table and doing atomic read/updates on these.