Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.
On Fri, 06 Jan 2006 08:30:40 +0100, Olaf Groeger <Olaf.Groeger at gmx.de> wrote: >Tony Hoyle wrote: > >> Olaf Groeger wrote: >>> Hmm, i'm not sure that i understood you. You suppose that the insert in >>> sessionlog doesn't returns the correct id but 0, which causes the 0 in >>> the successesive inserts into commitlog and historylog? >> >> Basically, yes. There's no standardised way in SQL of returning the id >> of the last insert... indeed some (Firebird) can't do it at all. In >> ODBC you can use select @@identity but that needs to be supported by the >> underlying driver. Most of the native drivers have a function that >> returns it. >> >Ah, ok. Now i understand. Well, this is because there is no standard about >"identity" columns. MSSQL manages them entirely (you can disable this), >PostGreSQL automatigally creates a sequence and auto-increments >(overwritable), MySql has an auto-increment feature, IIRC. But many >databases doesn't support such auto-valued columns at all (Oracle). >Consequently only those databases with auto values provide a way to return >the generated value. > >Back to the original posting: You're right: select @@identity doesn't work >with PostGreSQL. The error from the log is "ERROR: column "identity" does >not exist". > SQLite does work fine though... /Bo (Bo Berglund, developer in Sweden)