Pgerror Error Deadlock Detected
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack pg::trdeadlockdetected: error: deadlock detected Overflow the company Business Learn more about hiring developers or posting ads with us postgres deadlock detected sharelock Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a pg::trdeadlockdetected: error: deadlock detected rspec community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PostgreSQL : deadlock detected up vote 4 down vote favorite 1 Now, I'm using PostgresSQL
Postgresql Deadlock Detected
for my database system and faced deadlock problem from PL/SQL function. Please find the SQL statement in the code block. (Just example) BEGIN UPDATE accounts SET balance = 0 WHERE acct_name like 'A%'; UPDATE accounts SET balance = balance + 100 WHERE acct_name like '%A'; EXCEPTION WHEN OTHERS THEN RAISE NOTICE SQLERRM; END; I've found that the deadlock occurred during this statement was running. But i'm not sure that there were postgres deadlock query other statements trying to update this table in the same time (Rather not cause I didn't found any statement which trying to update this table in my logging system). So, is it possible that the deadlock was occurred within this statement ? As i know, if we blocked whole statement with BEGIN/END. There will be the same transaction and should not be locked by itself. Thanks in advance, Stoper postgresql deadlock share|improve this question edited Apr 9 '12 at 18:02 Mosty Mostacho 28.6k85689 asked Apr 9 '12 at 17:55 Sathapanic Sriprom 751414 Do you have any triggers on accounts? Also do you use explicit locking? –strkol Apr 9 '12 at 18:08 By default, a transaction can observe changes committed by other transactions. For more information, see Transaction Isolation from the PostgreSQL documentation. –Joey Adams Apr 9 '12 at 18:13 @strkol Yes I have, but statement in that trigger is not related to this table. For the explicit locking is also yes. –Sathapanic Sriprom Apr 9 '12 at 18:35 add a comment| 3 Answers 3 active oldest votes up vote 7 down vote accepted This is not a PL/SQL function. Looks like PL/pgSQL. There is definitely some other process competing for the same resource. Th
class="k">table parents( id class="n">serialActiverecord Statementinvalid Pg Trdeadlockdetected
Sign in Pricing Blog Support Search GitHub This repository Watch 245 Star 7,380 Fork 1,080 jnicklas/capybara Code Issues 11 Pull requests 5 Projects 0 Pulse Graphs Rspec after hook being called before spec finishs #1089 Closed rafaels opened this Issue May 22, 2013 · 43 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 23 participants and others rafaels commented May 22, 2013 I am having trouble with a scenario where I only do: click_link, which will fire an ajax request find something on a after(:each), I run DatabaseCleaner.clean The problem is, the ajax request is running at the same moment of the after(:each) block, which causes me to have a nil association in the model code. It is the real issue. I think that if I have a spec, it's after hooks should only run after all requests from this test are terminated. In my case I was getting controller and model code running at the same time as my DatabaseCleaner.clean, driving me to random errors when associations were not at the database anymore. I think it is a way important issue, cause I heard from people problems that fits it. For example, if I have an js: true spec and inside this spec I interact with the page and some ajax requests are fired, but my spec isn't testing this specific ajax requests, this problem can easily arrive. Say this ajax request is slow and the real spec finished without needing the response from this ajax. The example will pass at the beginning but the ajax will fail the example later because it needs somethings at the database. Please, if I can help more, get in touch. I am using capybara + rspec + poltergeist. PS. I resolved my problem with a better find, which will only be true when the ajax request returns and js renders the