Sammy Spets <sammys-drupal@synerger.com> writes:
PostgreSQL [has] serial and bigserial types. MySQL [has] auto_increment field property. These are used in Drupal to produce a guaranteed unique ID for tables using them.
We use db_next_id() in Drupal to provide a db-independent method of getting the next unique ID into the application for use just after the insert operation on the DB.
I interpret this to mean, in your opinion at least, that (a) Drupal does officially condone and support the use of auto-incrementing columns and (b) it also provides db_next_id() for those situations where having it is simply more convenient or efficient than letting the database do the id generation. Is that correct? Is this the official core policy on this subject?
I'm PostgreSQL maintainer for Drupal...
FYI, the Schema module now supports MySQL and PostgeSQL for table and index creation from the same schema data structure. I discovered the pgsql's use of the serial type during the implementation which is what led to my initiating this thread. Schema now supports a 'serial' column type which maps to auto_increment for MySQL or {,big}serial for PostgreSQL. I'd be very happy to have you review the pgsql support. Schema is currently in contrib. Thanks, Barry