Kevins is there several thread accessing the database at the same time ? if not you can simply do select max(uid) from table; and insert with the next available uid. On 11/1/06, Sami Näätänen <sn.ml@xxxxxxxxxxxx> wrote:
On Tuesday 31 October 2006 18:25, Kevin Jenkins wrote: > Sami, you said that PostgreSQL returns the oid of the inserted tuple. > Are you referring to the INSERT command, or the SELECT command > pointed out there? INSERT. > >> For MySQL, you'd use > >> SELECT LAST_INSERT_ID() > >> > >> For Transact-SQL (used by SQL Server and Sybase), you'd use > >> SELECT SCOPE_IDENTITY() > >> > >> For PostgreSQL, you'd use > >> SELECT CURRVAL('tablename_columnname_seq') > > > > PostgreSQL at least returns the oid of the inserted tuple. > > This of course is unique. This can be used to get any > > auto_increment etc stuff whit ease. So check the behaviour of the > > DB you use. It can provide some similar way to get that. > > > > PS. How it seams that every time I encounter new DB system > > PostgreSQL seams to do things right or better. :) Or maybe I'm a > > litle bit biased to PostgreSQL. ;) > > --------------------- > To unsubscribe go to http://gameprogrammer.com/mailinglist.html --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html
-- Olivier Delannoy ATER PRiSM Laboratory Versailles University, FRANCE