Project

General

Profile

« Previous | Next » 

Revision 12507

schemas/vegbien.sql: added public_validations.rm_all_queries(schema), which removes all validations queries in a schema, or in all schemas (useful when recreating validations queries from the DDL export file)

View differences:

trunk/schemas/vegbien.my.sql
1028 1028

  
1029 1029

  
1030 1030
--
1031
-- Name: rm_all_queries(varchar(255), anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
1032
--
1033

  
1034

  
1035

  
1036

  
1037
--
1038
-- Name: FUNCTION rm_all_queries(schema varchar(255), schema_anchor anyelement); Type: COMMENT; Schema: public_validations; Owner: -
1039
--
1040

  
1041

  
1042

  
1043

  
1044
--
1031 1045
-- Name: rm_query_group(varchar(255), anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
1032 1046
--
1033 1047

  
trunk/schemas/vegbien.sql
2324 2324

  
2325 2325

  
2326 2326
--
2327
-- Name: rm_all_queries(text, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
2328
--
2329

  
2330
CREATE FUNCTION rm_all_queries(schema text DEFAULT NULL::text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
2331
    LANGUAGE plpgsql
2332
    SET search_path TO pg_temp
2333
    AS $$
2334
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
2335
changes of search_path (schema elements are bound at inline time rather than
2336
runtime) */
2337
/* function option search_path is needed to limit the effects of
2338
`SET LOCAL search_path` to the current function */
2339
BEGIN
2340
	PERFORM util.use_schema(schema_anchor);
2341
	
2342
	PERFORM rm_query_view(view_, schema_anchor)
2343
	FROM validation_views(schema) view_
2344
	;
2345
END;
2346
$$;
2347

  
2348

  
2349
--
2350
-- Name: FUNCTION rm_all_queries(schema text, schema_anchor anyelement); Type: COMMENT; Schema: public_validations; Owner: -
2351
--
2352

  
2353
COMMENT ON FUNCTION rm_all_queries(schema text, schema_anchor anyelement) IS '
2354
removes all validations queries in a schema, or in all schemas
2355

  
2356
usage:
2357
SELECT public_validations.rm_all_queries(''datasource'');
2358

  
2359
idempotent
2360

  
2361
schema: if NULL, operates on all schemas
2362
schema_anchor: identifies this function''s schema. should be left as the default.
2363
';
2364

  
2365

  
2366
--
2327 2367
-- Name: rm_query_group(text, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
2328 2368
--
2329 2369

  

Also available in: Unified diff