|
| 1 | +-- The extension must work when installed into a non-default schema and called |
| 2 | +-- WITHOUT that schema on the search_path. Every function pins its own |
| 3 | +-- search_path to @extschema@, so qualified calls resolve their tables. |
| 4 | +\set ECHO none |
| 5 | +SELECT pgos_ext.create_user('alice') AS uid |
| 6 | +SELECT pgos_ext.create_role('ops') AS rid |
| 7 | +SELECT pgos_ext.assign_role_to_user(1, 1); |
| 8 | + assign_role_to_user |
| 9 | +--------------------- |
| 10 | + |
| 11 | +(1 row) |
| 12 | + |
| 13 | +SELECT pgos_ext.grant_permission_to_role(1, 'process', 'execute'); |
| 14 | + grant_permission_to_role |
| 15 | +-------------------------- |
| 16 | + |
| 17 | +(1 row) |
| 18 | + |
| 19 | +SELECT pgos_ext.grant_permission_to_role(1, 'memory', 'allocate'); |
| 20 | + grant_permission_to_role |
| 21 | +-------------------------- |
| 22 | + |
| 23 | +(1 row) |
| 24 | + |
| 25 | +SELECT pgos_ext.grant_permission_to_role(1, 'file', 'write'); |
| 26 | + grant_permission_to_role |
| 27 | +-------------------------- |
| 28 | + |
| 29 | +(1 row) |
| 30 | + |
| 31 | +CALL pgos_ext.create_process('p1', 1, 1); |
| 32 | +SELECT name, state FROM pgos_ext.processes ORDER BY name; |
| 33 | + name | state |
| 34 | +------+------- |
| 35 | + p1 | new |
| 36 | +(1 row) |
| 37 | + |
| 38 | +INSERT INTO pgos_ext.memory_segments (size) VALUES (4096); |
| 39 | +SELECT pgos_ext.allocate_memory(1, 1, 1024); |
| 40 | + allocate_memory |
| 41 | +----------------- |
| 42 | + |
| 43 | +(1 row) |
| 44 | + |
| 45 | +SELECT allocated, allocated_to FROM pgos_ext.memory_segments ORDER BY id; |
| 46 | + allocated | allocated_to |
| 47 | +-----------+-------------- |
| 48 | + t | 1 |
| 49 | +(1 row) |
| 50 | + |
| 51 | +SELECT pgos_ext.create_file(1, 'f.txt', NULL, FALSE) AS fid |
| 52 | +SELECT pgos_ext.write_file(1, 1, 'hi'); |
| 53 | + write_file |
| 54 | +------------ |
| 55 | + |
| 56 | +(1 row) |
| 57 | + |
| 58 | +SELECT pgos_ext.read_file(1, 1); |
| 59 | + read_file |
| 60 | +----------- |
| 61 | + hi |
| 62 | +(1 row) |
| 63 | + |
| 64 | +SELECT pgos_ext.create_mutex('m'); |
| 65 | + create_mutex |
| 66 | +-------------- |
| 67 | + |
| 68 | +(1 row) |
| 69 | + |
| 70 | +SELECT name, locked_by_thread FROM pgos_ext.mutexes; |
| 71 | + name | locked_by_thread |
| 72 | +------+------------------ |
| 73 | + m | |
| 74 | +(1 row) |
| 75 | + |
0 commit comments