Re: SQL-Invoked Procedures for 8.1
От | Alvaro Herrera |
---|---|
Тема | Re: SQL-Invoked Procedures for 8.1 |
Дата | |
Msg-id | 20041002191743.GA5738@dcc.uchile.cl обсуждение исходный текст |
Ответ на | Re: SQL-Invoked Procedures for 8.1 (Neil Conway <neilc@samurai.com>) |
Список | pgsql-hackers |
On Fri, Sep 24, 2004 at 07:28:09PM +1000, Neil Conway wrote: > On Fri, 2004-09-24 at 05:52, Alvaro Herrera wrote: > > I don't think we can do that in a standard function, at least not > > without a lot of work. > > Can you elaborate on why this would be so difficult? Because you have to keep the function state somewhere. Currently, all functions are handled in the SPI stack, which is dependent on the transaction machinery. So you'd have to move the function state somewhere else -- maybe keeping a special SPI stack outside transaction management. Or maybe the procedure handler does not use SPI at all. In any case, you need some way to handle cleaning it up if the procedure happens to fail; it needs to be able to cope with failing transactions that have to be handled (because some operations in the procedure can be handled), and some others that have to abort the procedure as a whole. This sounds like a meta-transaction (transaction of transactions). Apparently you also need some way to use "savepoints," but since you are not in a normal transaction you can't use the current mechanism for those. (Not sure if you really need cross-transaction "savepoints"). _And_ you need to handle all this from the procedure handler. The current SPI exposes a limited subset of transaction handling to function handlers; you'd need to extend that (unless you are planning to have non-pluggable procedure handlers). -- Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) "Tiene valor aquel que admite que es un cobarde" (Fernandel)
В списке pgsql-hackers по дате отправления: