On Monday 16 April 2007 14:56, johnf wrote: > On Monday 16 April 2007 10:28, Ed Leafe wrote: > > getLastRowID() > > I'll check into it. But as I recall was working.
The psycopg cursor.lastrowid returns the 'OID' of the record. This is not the PK of the record. In Larry's case (since we are not using oid's in our tables) returning a '0' was correct. However, that's not what he was expecting was it. So the question is what should we be doing with Postgres for Dabo? Postgres uses a sequence function to provide unique numbers. In the case of a PK a built-in data type "serial" is provided. The data type "serial" is nothing more than a special sequence function. Some of you might call this a 'auto increment' field. But the user does not have to use sequences as PK's. I can write a function that returns the last generated number using Postgres's 'lastval()' if the table uses a sequence. But what happens if the table does not use a sequence? Or does not have any PK? Or uses some compound index. -- John Fabiani _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
