Re: return values just commited

Gerhard Haering <[email protected]> Mon, 22 Nov 2004 09:19:09 +0100
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
On Mon, Nov 22, 2004 at 10:15:12AM +1000, Timothy Smith wrote:
> after i do a db.commit() is it possible to return the values written
> to the db? i have a transaction id that is an auto incrementing
> number, it would be much quicker if i could know that number without
> having to do a query

No, the only thing that's possible without issuing two queries is
cursor.oidValue. It's the PostgreSQL-internal id of the object (i. e.
row) you created.

PostgreSQL not having a RETURNING clause AFAIK if you insist on only
one statement, then I think you can achieve this with an appropriate
stored procedure that you call via pyPgSQL.

-- Gerhard
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBoaD9dIO4ozGCH14RAuotAKCi8GJxUHPlZVWG11zeL7hj3HNfpQCfQRmp
fhg1DxiszrGmDzVRymsyUMw=
=Dt6e
-----END PGP SIGNATURE-----