Re: Vote on SET in aborted transaction - Mailing list pgsql-hackers
From | Thomas Lockhart |
---|---|
Subject | Re: Vote on SET in aborted transaction |
Date | |
Msg-id | 3CC6BFDF.BCB12986@fourpalms.org Whole thread Raw |
In response to | Vote on SET in aborted transaction (Bruce Momjian <pgman@candle.pha.pa.us>) |
Responses |
Re: Vote on SET in aborted transaction
|
List | pgsql-hackers |
> OK, would people please vote on how to handle SET in an aborted > transaction? > at the end, should 'x' equal: > 1 - All SETs are rolled back in aborted transaction > 2 - SETs are ignored after transaction abort > 3 - All SETs are honored in aborted transaction > ? - Have SETs vary in behavior depending on variable I'll vote for "?", if for no other reason that you are proposing taking away a huge chunk of "language space" by apriori disallowing out of band behaviors for anything starting with "SET". I think that is likely Hiroshi's concern also. If we can fit all current "SET" behaviors into a transaction model, then I'm not against that (though we should review the list of attributes which *are* currently affected before settling on this). afaik we have not reviewed current behaviors and have not thought through the "what if's" that some soft of premature policy decision might constrain in the future. Let me give you some examples. We might someday have nested transactions, or transactions which can be resumed from the point of failure. We *might* want to be able to affect recovery behaviors, and we *might* want to do so with something like begin; update foo... update bar... <last update fails> set blah to blah update baz... update bar... <last update now succeeds> end; Now we currently *don't* support this behavior, but istm that we shouldn't preclude it in the language by forcing some blanket "all SET statements will be transaction aware". What language elements would you propose to cover the out of band cases if you *do* disallow "SET" in that context? If you don't have a candidate, I'd be even more reluctant to go along with the results of some arbitrary vote which is done in a narrow context. And btw, if we *are* going to put transaction semantics on all of our global variables (which is the context for starting this "SET" discussion, right? Is that really the context we are still in, even though you have phrased a much more general statement above?) then let's have the discussion on *HOW* we are going to accomplish that *BEFORE* deciding to make a semantic constraint on our language support. Hmm, if we are going to use transaction semantics, then we should consider using our existing transaction mechanisms, and if we use our existing transaction mechanisms we should consider pushing these global variables into tables or in memory tables a la "temp tables". We get the transaction semantics for free, with the cost of value lookup at the beginning of a transaction or statement (not sure what we can get away with here). If we are *not* going to use those existing mechanisms, then what mechanism *are* we going to use? Some sort of "abort hook" mechanism to allow SET to register things to be rolled back? If we end up making changes and increasing constraints, then we should also expect some increased functionality as part of the scheme, specifically "SET extensibility". We should allow (future) packages to define their parameters and allow SET to help. Just some thoughts... - Thomas
pgsql-hackers by date: