Re: [GENERAL] plgpsql and transactions

2006-04-07 Thread Terry Lee Tucker
> > > > In the latter, you have expanded the scope of the transaction; which, > > sometimes you might want to do. > > Yes, I might. But, I'd like to understand it so I do know when I might > or might not want to do it. Understanding is good. You need to read the documentation on transactions: htt

Re: [GENERAL] plgpsql and transactions

2006-04-07 Thread Bill Moseley
On Thu, Apr 06, 2006 at 03:48:15PM -0500, Terry Lee Tucker wrote: > > > > -- fires a trigger that updates more than one table > > insert into semething (default); > > > > and: > > > > begin; > > -- fires a trigger that updates more than one table > > insert into somthing (defaul

Re: [GENERAL] plgpsql and transactions

2006-04-06 Thread Terry Lee Tucker
On Thursday 06 April 2006 03:27 pm, Bill Moseley saith: > On Thu, Apr 06, 2006 at 01:44:57PM -0500, Terry Lee Tucker wrote: > > Triggers fire inside a transaction. > > Ah, thanks. Makes sense since each statement is in an implicit > transaction. > > Granted, would help to see the trigger, but > th

Re: [GENERAL] plgpsql and transactions

2006-04-06 Thread Bill Moseley
On Thu, Apr 06, 2006 at 01:44:57PM -0500, Terry Lee Tucker wrote: > Triggers fire inside a transaction. Ah, thanks. Makes sense since each statement is in an implicit transaction. Granted, would help to see the trigger, but these are basically the same? -- fires a trigger that updates more

Re: [GENERAL] plgpsql and transactions

2006-04-06 Thread Terry Lee Tucker
On Thursday 06 April 2006 02:36 pm, Bill Moseley saith: > In a BEFORE INSERT trigger, depending on input values, I need to lock > a table and do a few selects. Of course, the "lock table" isn't much > use if not currently in a transaction. > > So my question is this: can I tell if I'm inside a t

[GENERAL] plgpsql and transactions

2006-04-06 Thread Bill Moseley
In a BEFORE INSERT trigger, depending on input values, I need to lock a table and do a few selects. Of course, the "lock table" isn't much use if not currently in a transaction. So my question is this: can I tell if I'm inside a transaction or not and issue a BEGIN if not. And then also set a f