[subxact] Proof-of-concept: report nest level to client
От | Alvaro Herrera |
---|---|
Тема | [subxact] Proof-of-concept: report nest level to client |
Дата | |
Msg-id | 20040716073902.GA24711@dcc.uchile.cl обсуждение исходный текст |
Ответы |
Re: [subxact] Proof-of-concept: report nest level to client
|
Список | pgsql-patches |
Hackers, I tried to implement the reporting of the current transaction level to the client using an ad-hoc ParameterStatus message. Seems it works. To see it working I added a %d escape to psql prompt processing: alvherre=# \set PROMPT1 '%n@%/%R[%d]%x ' alvherre@alvherre=[0] begin; BEGIN alvherre@alvherre=[1]* savepoint foo; SAVEPOINT alvherre@alvherre=[2]* savepoint bar; SAVEPOINT alvherre@alvherre=[3]* release foo; RELEASE alvherre@alvherre=[1]* savepoint another; SAVEPOINT alvherre@alvherre=[2]* commit; COMMIT alvherre@alvherre=[0] (The nesting level, obviously, is the number between [ ]; the * is the "in transaction" mark, which existed previously. Yes, it works if it's > 9.) Patch attached (surprinsingly small), though it only applies with the savepoint patch applied(*). If any driver writer wants to play, however, it's easy to see what's going on -- a ParameterStatus message will be received from the backend whenever the nesting level changes. I added a function PQnestingLevel() to libpq, and a corresponding field in pg_conn. We have to decide if we like the name, and whether we want to have it at all. (This is different from the previous idea in that the nesting level is not a GUC variable -- the message is sent directly from xact.c. If this is a bad idea, just moving the SendTransactionNestingLevel() function can be moved somewhere else, though I couldn't figure out where.) (*) Even then, this is hand-edited output of interdiff, so maybe it doesn't apply at all ... if this is the case I'll submit a better patch tomorrow. -- Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) "No hay hombre que no aspire a la plenitud, es decir, la suma de experiencias de que un hombre es capaz"
Вложения
В списке pgsql-patches по дате отправления: