Project

General

Profile

« Previous | Next » 

Revision 12274

bugfix: schemas/vegbien.sql: setting search_path locally: also need to set function option search_path, in order to limit the effects of `SET LOCAL search_path` (mk_set_search_path()) to the current function (http://www.postgresql.org/docs/9.1/static/sql-set.html#AEN75423)

View differences:

trunk/schemas/vegbien.sql
717 717

  
718 718
CREATE FUNCTION datasource_publish(datasource text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
719 719
    LANGUAGE plpgsql
720
    SET search_path TO pg_temp
720 721
    AS $$
721 722
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
722 723
changes of search_path (schema elements are bound at inline time rather than
723 724
runtime) */
725
/* function option search_path is needed to limit the effects of
726
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
724 727
DECLARE
725 728
	live_datasource text := rm_version_suffix(datasource);
726 729
BEGIN
......
752 755

  
753 756
CREATE FUNCTION datasource_rename(old text, new text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
754 757
    LANGUAGE plpgsql
758
    SET search_path TO pg_temp
755 759
    AS $$
756 760
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
757 761
changes of search_path (schema elements are bound at inline time rather than
758 762
runtime) */
763
/* function option search_path is needed to limit the effects of
764
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
759 765
BEGIN
760 766
	EXECUTE util.mk_use_own_schema(schema_anchor);
761 767
	UPDATE source SET shortname = new WHERE shortname = old;
......
780 786

  
781 787
CREATE FUNCTION datasource_rm(datasource text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
782 788
    LANGUAGE plpgsql
789
    SET search_path TO pg_temp
783 790
    AS $$
784 791
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
785 792
changes of search_path (schema elements are bound at inline time rather than
786 793
runtime) */
794
/* function option search_path is needed to limit the effects of
795
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
787 796
BEGIN
788 797
	EXECUTE util.mk_use_own_schema(schema_anchor);
789 798
	DELETE FROM source WHERE shortname = datasource;
......
818 827

  
819 828
CREATE FUNCTION datasource_unpublish(datasource text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
820 829
    LANGUAGE plpgsql
830
    SET search_path TO pg_temp
821 831
    AS $$
822 832
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
823 833
changes of search_path (schema elements are bound at inline time rather than
824 834
runtime) */
835
/* function option search_path is needed to limit the effects of
836
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
825 837
BEGIN
826 838
	EXECUTE util.mk_use_own_schema(schema_anchor);
827 839
	PERFORM datasource_rename(datasource, datasource||'.new');
......
1359 1371

  
1360 1372
CREATE FUNCTION publish(schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
1361 1373
    LANGUAGE plpgsql
1374
    SET search_path TO pg_temp
1362 1375
    AS $$
1363 1376
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
1364 1377
changes of search_path (schema elements are bound at inline time rather than
1365 1378
runtime) */
1379
/* function option search_path is needed to limit the effects of
1380
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
1366 1381
BEGIN
1367 1382
	EXECUTE util.mk_use_own_schema(schema_anchor);
1368 1383
	PERFORM public_schema_publish(util.schema_esc(schema_anchor));
......
1393 1408

  
1394 1409
CREATE FUNCTION rm(schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
1395 1410
    LANGUAGE plpgsql
1411
    SET search_path TO pg_temp
1396 1412
    AS $$
1397 1413
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
1398 1414
changes of search_path (schema elements are bound at inline time rather than
1399 1415
runtime) */
1416
/* function option search_path is needed to limit the effects of
1417
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
1400 1418
BEGIN
1401 1419
	EXECUTE util.mk_use_own_schema(schema_anchor);
1402 1420
	PERFORM util.schema_bundle_rm(util.schema_esc(schema_anchor));
......
1438 1456

  
1439 1457
CREATE FUNCTION source_by_shortname(shortname text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS integer
1440 1458
    LANGUAGE plpgsql STABLE STRICT
1459
    SET search_path TO pg_temp
1441 1460
    AS $$
1442 1461
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
1443 1462
changes of search_path (schema elements are bound at inline time rather than
1444 1463
runtime) */
1464
/* function option search_path is needed to limit the effects of
1465
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
1445 1466
DECLARE
1446 1467
	source_id integer;
1447 1468
	shortname_ text = shortname;
......
1964 1985

  
1965 1986
CREATE FUNCTION rematerialize_out_view(datasource_schema text, out_view regclass) RETURNS regclass
1966 1987
    LANGUAGE plpgsql
1988
    SET search_path TO pg_temp
1967 1989
    AS $$
1968 1990
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
1969 1991
changes of search_path (schema elements are bound at inline time rather than
1970 1992
runtime) */
1993
/* function option search_path is needed to limit the effects of
1994
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
1971 1995
DECLARE
1972 1996
	out_table text = util.qual_name(datasource_schema,
1973 1997
		'_out_'||util.name(out_view));
......
2003 2027

  
2004 2028
CREATE FUNCTION rematerialize_out_view(in_view regclass, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS regclass
2005 2029
    LANGUAGE plpgsql
2030
    SET search_path TO pg_temp
2006 2031
    AS $$
2007 2032
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
2008 2033
changes of search_path (schema elements are bound at inline time rather than
2009 2034
runtime) */
2035
/* function option search_path is needed to limit the effects of
2036
`SET LOCAL search_path` (mk_set_search_path()) to the current function */
2010 2037
BEGIN
2011 2038
	EXECUTE util.mk_use_own_schema(schema_anchor);
2012 2039
	

Also available in: Unified diff