Re: About subxact and xact nesting level...

Поиск
Список
Период
Сортировка
От dandl
Тема Re: About subxact and xact nesting level...
Дата
Msg-id 00ce01d1a4dc$5c4dad90$14e908b0$@andl.org
обсуждение исходный текст
Ответ на Re: About subxact and xact nesting level...  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: About subxact and xact nesting level...  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> >> The file xact.c contains references to sub-transactions (subxact) and
> >> transaction nesting level, but no obvious documentation about what
> >> these correspond to in SQL.
> 
> > Subtransactions are used to implement SAVEPOINT, and also BEGIN blocks
> > with EXCEPTION clauses in plpgsql.
> 
> Yeah.  The implementation is based on nested subtransactions, and that
> concept also applies pretty directly to, eg, BEGIN/EXCEPT blocks in
plpgsql.
> But what's exposed to SQL is SAVEPOINT/RELEASE SAVEPOINT/ ROLLBACK TO
> SAVEPOINT, because those operations are what the standard specifies.  If
you
> hold your head at the correct angle you can see those as nested
> subtransactions, but it's not exactly obvious --- mainly because RELEASE
and
> ROLLBACK can exit multiple levels of nested subtransaction in one command.

Yes, that answers the question.

What now concerns me is that access to these capability seems to require
calling these three 'internal' functions, for which it's hard to determine
the prerequisites. The SPI interface is well-documented and the conversion
functions I'm using are not stateful and look pretty safe. I've got the
process model figured out well enough, but the transaction model is not so
easy. State looks important; so does memory management.

Are there specific requirements or things to do/avoid in order to use
subtransactions (at the PL API level)?

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org








В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Reviewing freeze map code
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Fix for OpenSSL error queue bug