1
2 do $$
3 declare
4 res_id int;
5 begin
6 insert into Resource (nodename, iscollection) values ('', true);
7 res_id := lastval();
8
9 insert into Resource(parent_id, nodename, resoid) values
10 (res_id, 'file1.txt', (select lo_create(0))),
11 (res_id, 'file2.txt', (select lo_create(0))),
12 (res_id, 'file3.txt', (select lo_create(0))),
13 (res_id, 'file4.txt', (select lo_create(0)));
14
15 insert into Resource(parent_id, nodename, iscollection) values
16 (res_id, 'dir1', true);
17 res_id := lastval();
18
19 insert into Resource(parent_id, nodename, iscollection) values
20 (res_id, 'dir2', true);
21 res_id := lastval();
22
23 insert into Resource(parent_id, nodename, resoid) values
24 (res_id, 'd1file1.txt', (select lo_create(0))),
25 (res_id, 'd2file1.txt', (select lo_create(0))),
26 (res_id, 'd2file2.txt', (select lo_create(0)));
27
28 end $$;
29
30