Project

General

Profile

« Previous | Next » 

Revision 12490

schemas/util.sql: use_own_schema(): renamed to use_schema() because this can be used for any type-linked schema

View differences:

trunk/schemas/util.sql
3506 3506

  
3507 3507

  
3508 3508
--
3509
-- Name: use_own_schema(anyelement); Type: FUNCTION; Schema: util; Owner: -
3509
-- Name: use_schema(anyelement); Type: FUNCTION; Schema: util; Owner: -
3510 3510
--
3511 3511

  
3512
CREATE FUNCTION use_own_schema(schema_anchor anyelement) RETURNS void
3512
CREATE FUNCTION use_schema(schema_anchor anyelement) RETURNS void
3513 3513
    LANGUAGE sql
3514 3514
    AS $_$
3515 3515
SELECT util.set_search_path(util.mk_search_path(util.schema($1)))
......
3517 3517

  
3518 3518

  
3519 3519
--
3520
-- Name: FUNCTION use_own_schema(schema_anchor anyelement); Type: COMMENT; Schema: util; Owner: -
3520
-- Name: FUNCTION use_schema(schema_anchor anyelement); Type: COMMENT; Schema: util; Owner: -
3521 3521
--
3522 3522

  
3523
COMMENT ON FUNCTION use_own_schema(schema_anchor anyelement) IS '
3523
COMMENT ON FUNCTION use_schema(schema_anchor anyelement) IS '
3524 3524
auto-appends util to the search_path to enable use of util operators
3525 3525
';
3526 3526

  
trunk/schemas/vegbien.sql
727 727
DECLARE
728 728
	live_datasource text := rm_version_suffix(datasource);
729 729
BEGIN
730
	PERFORM util.use_own_schema(schema_anchor);
730
	PERFORM util.use_schema(schema_anchor);
731 731
	
732 732
	-- don't datasource_rm() the datasource to publish!
733 733
	IF live_datasource = datasource THEN RETURN; END IF;
......
763 763
/* function option search_path is needed to limit the effects of
764 764
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
765 765
BEGIN
766
	PERFORM util.use_own_schema(schema_anchor);
766
	PERFORM util.use_schema(schema_anchor);
767 767
	UPDATE source SET shortname = new WHERE shortname = old;
768 768
END;
769 769
$$;
......
794 794
/* function option search_path is needed to limit the effects of
795 795
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
796 796
BEGIN
797
	PERFORM util.use_own_schema(schema_anchor);
797
	PERFORM util.use_schema(schema_anchor);
798 798
	DELETE FROM source WHERE shortname = datasource;
799 799
END;
800 800
$$;
......
835 835
/* function option search_path is needed to limit the effects of
836 836
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
837 837
BEGIN
838
	PERFORM util.use_own_schema(schema_anchor);
838
	PERFORM util.use_schema(schema_anchor);
839 839
	PERFORM datasource_rename(datasource, datasource||'.new');
840 840
END;
841 841
$$;
......
1379 1379
/* function option search_path is needed to limit the effects of
1380 1380
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
1381 1381
BEGIN
1382
	PERFORM util.use_own_schema(schema_anchor);
1382
	PERFORM util.use_schema(schema_anchor);
1383 1383
	PERFORM public_schema_publish(util.schema_esc(schema_anchor));
1384 1384
END;
1385 1385
$$;
......
1416 1416
/* function option search_path is needed to limit the effects of
1417 1417
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
1418 1418
BEGIN
1419
	PERFORM util.use_own_schema(schema_anchor);
1419
	PERFORM util.use_schema(schema_anchor);
1420 1420
	PERFORM util.schema_bundle_rm(util.schema_esc(schema_anchor));
1421 1421
END;
1422 1422
$$;
......
1467 1467
	source_id_ integer;
1468 1468
	shortname_ text = shortname;
1469 1469
BEGIN
1470
	PERFORM util.use_own_schema(schema_anchor);
1470
	PERFORM util.use_schema(schema_anchor);
1471 1471
	
1472 1472
	SELECT source_id INTO source_id_
1473 1473
	FROM source WHERE source.shortname = shortname_ LIMIT 1
......
2067 2067
	diff_table text = util.qual_name(util.schema(in_view),
2068 2068
		'_diff_'||util.name(in_view));
2069 2069
BEGIN
2070
	PERFORM util.use_own_schema(schema_anchor);
2070
	PERFORM util.use_schema(schema_anchor);
2071 2071
	
2072 2072
	PERFORM util.remake_diff_table(diff_table, rematerialize_in_view(in_view),
2073 2073
		rematerialize_out_view(in_view), type_table);
......
2113 2113
/* function option search_path is needed to limit the effects of
2114 2114
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
2115 2115
BEGIN
2116
	PERFORM util.use_own_schema(schema_anchor);
2116
	PERFORM util.use_schema(schema_anchor);
2117 2117
	
2118 2118
	PERFORM remake_diff_tables(schema) FROM validatable_datasources() schema;
2119 2119
END;
......
2137 2137
	errors_ct integer = 0;
2138 2138
	in_view regclass;
2139 2139
BEGIN
2140
	PERFORM util.use_own_schema(schema_anchor);
2140
	PERFORM util.use_schema(schema_anchor);
2141 2141
	
2142 2142
	FOR in_view IN SELECT * FROM validation_views(schema)
2143 2143
	LOOP
......
2253 2253
/* function option search_path is needed to limit the effects of
2254 2254
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
2255 2255
BEGIN
2256
	PERFORM util.use_own_schema(schema_anchor);
2256
	PERFORM util.use_schema(schema_anchor);
2257 2257
	
2258 2258
	RETURN rematerialize_out_view(datasource_schema := util.schema(in_view),
2259 2259
		out_view := util.qual_name(util.schema(schema_anchor),
......
2290 2290
/* function option search_path is needed to limit the effects of
2291 2291
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
2292 2292
BEGIN
2293
	PERFORM util.use_own_schema(schema_anchor);
2293
	PERFORM util.use_schema(schema_anchor);
2294 2294
	
2295 2295
	PERFORM util.rename_relation(view_,
2296 2296
		new_query_view_relation_name(util.name(from_), to_, util.name(view_)))
......
2360 2360
/* function option search_path is needed to limit the effects of
2361 2361
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
2362 2362
BEGIN
2363
	PERFORM util.use_own_schema(schema_anchor);
2363
	PERFORM util.use_schema(schema_anchor);
2364 2364
	
2365 2365
	PERFORM util.drop_relation(view_, force := true)
2366 2366
		-- force: needed because some query-view-relations depend on others
......
2400 2400
/* function option search_path is needed to limit the effects of
2401 2401
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
2402 2402
BEGIN
2403
	PERFORM util.use_own_schema(schema_anchor);
2403
	PERFORM util.use_schema(schema_anchor);
2404 2404
	
2405 2405
	RETURN QUERY
2406 2406
		SELECT DISTINCT util.schema(view) FROM validation_views() view;

Also available in: Unified diff