Re: [GENERAL] Serializable transaction restart/re-execute

2015-04-08 Thread Filipe Pina
Exactly, my point was not to repeat point 4 but the whole step. Upon serialization failure exception it would re-read data from database, perform the same something with data and save it. And point 2 is the part that fails in my "restart wrapper" function in the code I posted in stackoverflow, it

Re: [GENERAL] Serializable transaction restart/re-execute

2015-04-07 Thread Jim Nasby
On 4/6/15 6:42 AM, Bill Moran wrote: CREATE OR REPLACE FUNCTION mytest() RETURNS integer AS $$ BEGIN update account set balance = balance+10 where id=1 RETURNING balance; END $$ LANGUAGE SQL; of course, it's unlikely that you'll ever want to wrap such a simple query in a function, so I'm su

Re: [GENERAL] Serializable transaction restart/re-execute

2015-04-06 Thread Filipe Pina
y "restart" the failed transactions... -Original Message- From: Bill Moran [mailto:wmo...@potentialtech.com] Sent: 3 de abril de 2015 23:07 To: Filipe Pina Cc: Postgresql General Subject: Re: [GENERAL] Serializable transaction restart/re-execute On Fri, 3 Apr 2015 15:35:14 +0100 Fil

Re: [GENERAL] Serializable transaction restart/re-execute

2015-04-06 Thread Filipe Pina
Hi Kevin, thank you very much for reply. We plan to have a middleware/gateway in our full solution so we could have the restart logic there but that would only apply to external interface calls. We plan to have a few "backend processes" that we want to run directly in pgsql and those would not ha

Re: [GENERAL] Serializable transaction restart/re-execute

2015-04-06 Thread Kevin Grittner
Filipe Pina wrote: > I come from a GTM background and once of the transactional > features there are the “Transaction Restarts”. > > Transaction restart is when we have two concurrent processes > reading/writing to the same region/table of the database, the > last process to commit will “see” tha

Re: [GENERAL] Serializable transaction restart/re-execute

2015-04-06 Thread Filipe Pina
Thank you very much for such detailed response. Indeed I'm thinking too much "GTM" instead of actually changing the mindset, but the problem with LOCKs (which are also available in GTM) is that the developer does have to remind to lock what they want to use for update and if they don't, integrity/

Re: [GENERAL] Serializable transaction restart/re-execute

2015-04-06 Thread Bill Moran
On Mon, 6 Apr 2015 10:41:25 +0100 Filipe Pina wrote: > Hi Bill, thanks for the quick reply. > > I had read about SAVEPOINTs but I also read I cannot use them in PLPGSQL and > should use BEGIN/END blocks and EXCEPTIONs. > > Did you check the URL I mentioned? Yes, I did: http://stackoverflow.com

Re: [GENERAL] Serializable transaction restart/re-execute

2015-04-06 Thread Filipe Pina
Hi Bill, thanks for the quick reply. I had read about SAVEPOINTs but I also read I cannot use them in PLPGSQL and should use BEGIN/END blocks and EXCEPTIONs. Did you check the URL I mentioned? I have the code I used there: CREATE OR REPLACE FUNCTION myretest() RETURNS integer AS $$ DECLARE t

Re: [GENERAL] Serializable transaction restart/re-execute

2015-04-03 Thread Bill Moran
On Fri, 3 Apr 2015 15:35:14 +0100 Filipe Pina wrote: > Hello, > > I come from a GTM background and once of the transactional features there are > the ?Transaction Restarts?. > > Transaction restart is when we have two concurrent processes reading/writing > to the same region/table of the data