| 11 | |
| 12 | Jeśli właścicielem tabeli, widoków są edokumnety nie musimy wykonywać żadnych dodatkowych czynności. W przeciwnym wypadku należy zmienić właściciela na ''edokumnety'' |
| 13 | Aby to wykonać wykonujemy poniższe zapytania. Zapytania wykonujemy pojedzyńczo z uwagi gdyż przy hurtowym zapytaniu mogą się nie wykonać. |
| 14 | |
| 15 | {{{ |
| 16 | create or replace function my_exec1(text) returns void as $$ |
| 17 | begin |
| 18 | execute $1; |
| 19 | end; |
| 20 | $$ language plpgsql; |
| 21 | }}} |
| 22 | |
| 23 | |
| 24 | {{{ |
| 25 | SELECT my_exec1('ALTER SCHEMA ' || aa || ' OWNER TO edokumenty') FROM bs_unnest(array['public', 'syncml_server', 'reports', 'vindication']) aa; |
| 26 | SELECT my_exec1('GRANT USAGE ON SCHEMA ' || aa || ' TO http') FROM bs_unnest(array['public', 'syncml_server', 'reports', 'vindication']) aa; |
| 27 | }}} |
| 28 | |
| 29 | |
| 30 | {{{ |
| 31 | SELECT my_exec1('ALTER TABLE ' || table_schema || '.' || table_name || ' OWNER TO edokumenty') FROM information_schema.views WHERE table_schema IN ('public', 'syncml_server', 'reports', 'vindication'); |
| 32 | SELECT my_exec1('GRANT SELECT ON ' || table_schema || '.' || table_name || ' TO http') FROM information_schema.views WHERE table_schema IN ('public', 'syncml_server', 'reports', 'vindication'); |
| 33 | }}} |
| 34 | |
| 35 | |
| 36 | {{{ |
| 37 | select my_exec1('ALTER TABLE ' || schemaname || '.' || tablename || ' OWNER TO edokumenty') from pg_tables where schemaname IN ('public', 'syncml_server', 'reports', 'vindication'); |
| 38 | select my_exec1('GRANT select, insert, update, delete ON ' || schemaname || '.' || tablename || ' to http') from pg_tables where schemaname IN ('public', 'syncml_server', 'reports', 'vindication'); |
| 39 | }}} |
| 40 | |
| 41 | |
| 42 | {{{ |
| 43 | SELECT my_exec1('ALTER TABLE ' || sequence_schema || '.' || sequence_name || ' OWNER TO edokumenty') FROM information_schema.sequences WHERE sequence_schema IN ('public', 'syncml_server', 'reports', 'vindication'); |
| 44 | SELECT my_exec1('GRANT USAGE ON SEQUENCE ' || sequence_schema || '.' || sequence_name || ' TO http') FROM information_schema.sequences WHERE sequence_schema IN ('public', 'syncml_server', 'reports', 'vindication'); |
| 45 | }}} |
| 46 | |
| 47 | |
| 48 | {{{ |
| 49 | drop function my_exec1(text); |
| 50 | }}} |