Project

General

Profile

« Previous | Next » 

Revision 12257

schemas/vegbien.sql: functions with schema_anchors: documented that they must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime changes of search_path (schema elements are bound at inline time rather than runtime)

View differences:

trunk/schemas/vegbien.sql
718 718
CREATE FUNCTION datasource_publish(datasource text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
719 719
    LANGUAGE plpgsql
720 720
    AS $$
721
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
722
changes of search_path (schema elements are bound at inline time rather than
723
runtime) */
721 724
DECLARE
722 725
	live_datasource text := rm_version_suffix(datasource);
723 726
BEGIN
......
750 753
CREATE FUNCTION datasource_rename(old text, new text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
751 754
    LANGUAGE plpgsql
752 755
    AS $$
756
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
757
changes of search_path (schema elements are bound at inline time rather than
758
runtime) */
753 759
BEGIN
754 760
	PERFORM set_config('search_path', util.schema_esc(schema_anchor), true);
755 761
	UPDATE source SET shortname = new WHERE shortname = old;
......
775 781
CREATE FUNCTION datasource_rm(datasource text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
776 782
    LANGUAGE plpgsql
777 783
    AS $$
784
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
785
changes of search_path (schema elements are bound at inline time rather than
786
runtime) */
778 787
BEGIN
779 788
	PERFORM set_config('search_path', util.schema_esc(schema_anchor), true);
780 789
	DELETE FROM source WHERE shortname = datasource;
......
810 819
CREATE FUNCTION datasource_unpublish(datasource text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
811 820
    LANGUAGE plpgsql
812 821
    AS $$
822
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
823
changes of search_path (schema elements are bound at inline time rather than
824
runtime) */
813 825
BEGIN
814 826
	PERFORM set_config('search_path', util.schema_esc(schema_anchor), true);
815 827
	PERFORM datasource_rename(datasource, datasource||'.new');
......
1348 1360
CREATE FUNCTION publish(schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
1349 1361
    LANGUAGE plpgsql
1350 1362
    AS $$
1363
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
1364
changes of search_path (schema elements are bound at inline time rather than
1365
runtime) */
1351 1366
BEGIN
1352 1367
	PERFORM set_config('search_path', util.schema_esc(schema_anchor), true);
1353 1368
	PERFORM public_schema_publish(util.schema_esc(schema_anchor));
......
1379 1394
CREATE FUNCTION rm(schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
1380 1395
    LANGUAGE plpgsql
1381 1396
    AS $$
1397
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
1398
changes of search_path (schema elements are bound at inline time rather than
1399
runtime) */
1382 1400
BEGIN
1383 1401
	PERFORM set_config('search_path', util.schema_esc(schema_anchor), true);
1384 1402
	PERFORM util.schema_bundle_rm(util.schema_esc(schema_anchor));

Also available in: Unified diff