Switching between terminals

From: cinu <cheriyamoozhiyilcinu(at)yahoo(dot)co(dot)in>
To: pgsql-hackers(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Switching between terminals
Date: 2008-07-03 14:26:56
Message-ID: 31174.66139.qm@web7904.mail.in.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi All, I am having an issue with a deadlock scenario in PostgreSQL 8.3.1I have the following database postgres, what I do is create two tables t1 and t2 in this database and I have the following fileds t1(a_id smallint, fn character(20), ln character(20), rt smallint)t2( c_id smallint, c_name character(20));The connection to the "postgres" database is established through two terminals;From the 1st terminal I give the following command1) begin transaction; update t2 set c_name = 'lock' where c_id = 1;From the 2nd terminal I give the following command2) begin transaction; update t1 set ln = 'lock' where a_id = 1;Then I come back to the 1st terminal and execute the following3) update t1 set ln = 'lock' where a_id = 1;Then I come to 2nd Terminal and execute the following 4) update t2 set c_name = 'lock' where c_id = 1;When I come out I get the following error message ERROR: deadlock detected
DETAIL: Process 15171 waits for ShareLock on transaction 12738; blocked by process 15183.
Process 15183 waits for ShareLock on transaction 12739; blocked by process 15171.This is perfectly fine, but what i am trying to acheive is that I am putting the above four queries in 4 different .sql files and executing it in the same way as displayed above by using two different terminals, please refer below the sequence which I am using.From the 1st terminal I give the following command1) psql -f dl11.sql -U postgres -d postgresFrom the 2nd terminal I give the following command2) psql -f dl21.sql -U postgres -d postgresThen I come back to the 1st terminal and execute the following3) psql -f dl12.sql -U postgres -d postgresThen I come to 2nd Terminal and execute the following4) psql -f dl22.sql -U postgres -d postgresI should be getting the same message about deadlock detection, but I am unable to get that.Could anyone please tell me where I am going wrong and if there is a way I can get the same behaviour that I am getting while I am executing the
through psql prompt.Thanks in advanceWaiting for replyRegardsCinu

Explore your hobbies and interests. Go to http://in.promos.yahoo.com/groups/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Csaba Nagy 2008-07-03 14:59:17 Re: [HACKERS] Switching between terminals
Previous Message Gregory Stark 2008-07-03 14:21:50 Re: Functional index adding one

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2008-07-03 14:36:02 Re: Adding variables for segment_size, wal_segment_size and block sizes
Previous Message Aaron Spiteri 2008-07-03 13:37:17 Re: Command execution