[Zope] [SQL] Retrieving info from the previous SQL insert

Stephane Bortzmeyer bortzmeyer@netaktiv.com
Tue, 11 Dec 2001 09:57:12 +0100


I have a SQL method which performs an INSERT in one table, followed by
an INSERT into another table. The two INSERTs have to be in the same
method because they need to be atomic.

In the first table, there is an auto-incrementing field that the
PostgreSQL DBMS assigns itself. I need the value of that field for the
second INSERT and I don't see how to retrieve it inside the SQL
method.

Yes, I'll read more deeply PostgreSQL documentation and Zope
documentation and <dtml-var my_postgresql_zope_adapter> documentation
but, in the mean time, if someone has a ready-to-use solution?