1# The deadlock detector has a special case for "simple" deadlocks.  A simple
2# deadlock occurs when we attempt a lock upgrade while another process waits
3# for a lock upgrade on the same object; and the sought locks conflict with
4# those already held, so that neither process can complete its upgrade until
5# the other releases locks.  Test this scenario.
6
7setup
8{
9  CREATE TABLE a1 ();
10}
11
12teardown
13{
14  DROP TABLE a1;
15}
16
17session s1
18setup		{ BEGIN; }
19step s1as	{ LOCK TABLE a1 IN ACCESS SHARE MODE; }
20step s1ae	{ LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; }
21step s1c	{ COMMIT; }
22
23session s2
24setup		{ BEGIN; }
25step s2as	{ LOCK TABLE a1 IN ACCESS SHARE MODE; }
26step s2ae	{ LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; }
27step s2c	{ COMMIT; }
28
29permutation s1as s2as s1ae s2ae s1c s2c
30