-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathex_trans.sql
33 lines (29 loc) · 828 Bytes
/
ex_trans.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
create table tu (a int, b int);
create or replace function uu(abort bool) returns bool as '
transaction do |txn|
PL.exec("insert into tu values (1, 2)")
transaction do |txn1|
PL.exec("insert into tu values (3, 4)")
txn1.abort
end
PL.exec("insert into tu values (5, 6)")
txn.abort if abort
end
abort
' language 'plruby';
create or replace function uu() returns bool as '
transaction do |txn1|
PL.exec("insert into tu values (3, 4)")
txn1.abort
end
true
' language 'plruby';
create or replace function tt(abort bool) returns bool as '
transaction do |txn|
PL.exec("insert into tu values (1, 2)")
PL.exec("select uu()")
PL.exec("insert into tu values (5, 6)")
txn.abort if abort
end
abort
' language 'plruby';