1# If we already hold a lock of a given strength, do not deadlock when
2# some other transaction is waiting for a conflicting lock and we try
3# to acquire the same lock we already held.
4setup
5{
6  CREATE TABLE justthis (
7	value	int
8  );
9
10  INSERT INTO justthis VALUES (1);
11}
12
13teardown
14{
15  DROP TABLE justthis;
16}
17
18session s1
19setup			{ BEGIN; }
20step s1lock		{ SELECT * FROM justthis FOR SHARE; }
21step s1svpt		{ SAVEPOINT foo; }
22step s1lock2	{ SELECT * FROM justthis FOR SHARE; }
23step s1c		{ COMMIT; }
24
25session s2
26setup			{ BEGIN; }
27step s2lock		{ SELECT * FROM justthis FOR SHARE; }	# ensure it's a multi
28step s2c		{ COMMIT; }
29
30session s3
31setup			{ BEGIN; }
32step s3lock		{ SELECT * FROM justthis FOR UPDATE; }
33step s3c		{ COMMIT; }
34
35permutation s1lock s2lock s1svpt s3lock s1lock2 s2c s1c s3c
36