Re: [PATCHES] Summary table trigger example race condition

2006-02-23 Thread Jim C. Nasby
On Wed, Feb 22, 2006 at 06:50:32PM -0600, Jim C. Nasby wrote: > Ok, here's some *Uber Ugly* code I hacked together to do something > similar for a potential book project. It's based loosely on docbook. Ok, no, for real this time... it's at http://jim.nasby.net/sgmlcode/ Thanks to all that pointed

Re: [PATCHES] Summary table trigger example race condition

2006-02-22 Thread Jim C. Nasby
On Fri, Jan 06, 2006 at 04:46:26PM +1300, Mark Kirkwood wrote: > Jim C. Nasby wrote: > >On Fri, Jan 06, 2006 at 02:00:34PM +1300, Mark Kirkwood wrote: > > > >>However, I think the actual change is not quite right - after running > > > > > >DOH! It would be good if doc/src had a better mechanism fo

Re: [PATCHES] Summary table trigger example race condition

2006-02-04 Thread Bruce Momjian
Patch applied to HEAD and 8.1.X. Thanks. --- Jim C. Nasby wrote: > On Fri, Jan 06, 2006 at 02:00:34PM +1300, Mark Kirkwood wrote: > > However, I think the actual change is not quite right - after running > > DOH! It would

Re: [PATCHES] Summary table trigger example race condition

2006-01-12 Thread Alvaro Herrera
Mark Kirkwood wrote: > Yes it would - I usually build the SGML -> HTML, then cut the code out > of a browser session to test - the pain is waiting for the docs to build. FWIW, what I do is to build a cut-down version of postgres.sgml to include only the file you want to check. I think there is

Re: [PATCHES] Summary table trigger example race condition

2006-01-10 Thread Mark Kirkwood
Mark Kirkwood wrote: Jim C. Nasby wrote: On Sun, Jan 08, 2006 at 04:13:01PM +1300, Mark Kirkwood wrote: What happens if someone deletes the row between the failed insert and the second update? :) In this example the rows in the summary table never get deleted by DELETE operations on that

Re: [PATCHES] Summary table trigger example race condition

2006-01-10 Thread Mark Kirkwood
Jim C. Nasby wrote: On Sun, Jan 08, 2006 at 04:13:01PM +1300, Mark Kirkwood wrote: After re-examining the original code, it looks like it was not actually vulnerable to a race condition! (it does the UPDATE, then if not found will do an INSERT, and handle unique violation with a repeat of the

Re: [PATCHES] Summary table trigger example race condition

2006-01-10 Thread Jim C. Nasby
On Sun, Jan 08, 2006 at 04:13:01PM +1300, Mark Kirkwood wrote: > After re-examining the original code, it looks like it was not actually > vulnerable to a race condition! (it does the UPDATE, then if not found > will do an INSERT, and handle unique violation with a repeat of the same > UPDATE -

Re: [PATCHES] Summary table trigger example race condition

2006-01-07 Thread Mark Kirkwood
Mark Kirkwood wrote: Jim C. Nasby wrote: On Fri, Jan 06, 2006 at 02:00:34PM +1300, Mark Kirkwood wrote: However, I think the actual change is not quite right - after running DOH! It would be good if doc/src had a better mechanism for handling code; one that would allow for writing the cod

Re: [PATCHES] Summary table trigger example race condition

2006-01-05 Thread Mark Kirkwood
Jim C. Nasby wrote: On Fri, Jan 06, 2006 at 02:00:34PM +1300, Mark Kirkwood wrote: However, I think the actual change is not quite right - after running DOH! It would be good if doc/src had a better mechanism for handling code; one that would allow for writing the code natively (so you don't

Re: [PATCHES] Summary table trigger example race condition

2006-01-05 Thread Jim C. Nasby
On Fri, Jan 06, 2006 at 02:00:34PM +1300, Mark Kirkwood wrote: > However, I think the actual change is not quite right - after running DOH! It would be good if doc/src had a better mechanism for handling code; one that would allow for writing the code natively (so you don't have to worry about tr

Re: [PATCHES] Summary table trigger example race condition

2006-01-05 Thread Mark Kirkwood
Jim C. Nasby wrote: http://www.postgresql.org/docs/current/static/plpgsql-trigger.html example 36-4 has a race condition in the code that checks to see if a row exists. It should use the code from example 36-1. This patch fixes that. It also adds some commands to show what the summary table outpu