comparison db_schema/audit.sql @ 1314:1a3e86f4d768

Fix broken array and improve readability of function definition.
author Tom Gottfried <tom@intevation.de>
date Fri, 17 Mar 2017 13:00:31 +0100
parents c2df9c848e9d
children 84bb7e2aecb1
comparison
equal deleted inserted replaced
1313:b5ab25b7ac2c 1314:1a3e86f4d768
119 $body$ 119 $body$
120 LANGUAGE plpgsql 120 LANGUAGE plpgsql
121 SECURITY DEFINER 121 SECURITY DEFINER
122 SET search_path = land, public; 122 SET search_path = land, public;
123 123
124 CREATE OR REPLACE FUNCTION audit_table(target_table regclass, audit_rows boolean, audit_query_text boolean, ignored_cols text[]) RETURNS void AS $body$ 124 CREATE OR REPLACE FUNCTION audit_table(
125 target_table regclass,
126 audit_rows boolean,
127 audit_query_text boolean,
128 ignored_cols text[]
129 ) RETURNS void AS
130 $body$
125 DECLARE 131 DECLARE
126 stm_targets text = 'INSERT OR UPDATE OR DELETE OR TRUNCATE'; 132 stm_targets text = 'INSERT OR UPDATE OR DELETE OR TRUNCATE';
127 _q_txt text; 133 _q_txt text;
128 _ignored_cols_snip text = ''; 134 _ignored_cols_snip text = '';
129 BEGIN 135 BEGIN
213 cast(row_data ->> 'messungs_id' AS int) AS messungs_id 219 cast(row_data ->> 'messungs_id' AS int) AS messungs_id
214 FROM audit_trail; 220 FROM audit_trail;
215 221
216 222
217 SELECT audit_table('probe', true, false, '{id, tree_modified, letzte_aenderung}'::text[]); 223 SELECT audit_table('probe', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
218 SELECT audit_table('messung', true, false, '{id,, tree_modified, letzte_aenderung, status}'::text[]); 224 SELECT audit_table('messung', true, false,
225 '{id, tree_modified, letzte_aenderung, status}'::text[]);
219 SELECT audit_table('messwert', true, false, '{id, tree_modified, letzte_aenderung}'::text[]); 226 SELECT audit_table('messwert', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
220 SELECT audit_table('kommentar_p', true, false, '{id, tree_modified, letzte_aenderung}'::text[]); 227 SELECT audit_table('kommentar_p', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
221 SELECT audit_table('kommentar_m', true, false, '{id, tree_modified, letzte_aenderung}'::text[]); 228 SELECT audit_table('kommentar_m', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
222 SELECT audit_table('zusatz_wert', true, false, '{id, tree_modified, letzte_aenderung}'::text[]); 229 SELECT audit_table('zusatz_wert', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
223 SELECT audit_table('ortszuordnung', true, false, '{id, tree_modified, letzte_aenderung}'::text[]); 230 SELECT audit_table('ortszuordnung', true, false, '{id, tree_modified, letzte_aenderung}'::text[]);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)