PostgreSQL Interface Query

Federico Di Gregorio fog at debian.org
Thu Oct 18 08:49:38 EDT 2001


In <3BC990D7.2680A5AE at iinet.net.au>, John Bell wrote:

> Stuart Bishop wrote:
[snip]
> For the moment the low level of thread safety is not an issue in this
> project.  I agree that under most circumstances it would be better to
> stick strictly to the DB API.  However, there appears to be a situation
> that is only covered by the pypgsql package.  The cursor object has an
> attribute which stores the OID of the last inserted row thus allowing
> for the indirect retrieval of SERIAL keys for insertion in foreign key
> fields.  This doesn't seem to be achievable in either PoPy or psycopg.
> Please correct me if I'm wrong.

you are wrong. :) psycopg cursors have a .lastoid() method that does
exactly that.

-- 
Federico Di Gregorio
Debian GNU/Linux Developer & Italian Press Contact        fog at debian.org
INIT.D Developer                                           fog at initd.org
   God is real. Unless declared integer. -- Anonymous FORTRAN programmer



More information about the Python-list mailing list