Project

General

Profile

« Previous | Next » 

Revision 12466

schemas/util.sql: mk_set_search_path(): support creating a SET search_path statement for display as well, which would exclude LOCAL because it doesn't work as a standalone command (http://www.postgresql.org/docs/9.3/static/sql-set.html#AEN81154)

View differences:

trunk/schemas/util.sql
2094 2094

  
2095 2095

  
2096 2096
--
2097
-- Name: mk_set_search_path(text); Type: FUNCTION; Schema: util; Owner: -
2097
-- Name: mk_set_search_path(text, boolean); Type: FUNCTION; Schema: util; Owner: -
2098 2098
--
2099 2099

  
2100
CREATE FUNCTION mk_set_search_path(search_path text) RETURNS text
2100
CREATE FUNCTION mk_set_search_path(search_path text, for_printing boolean DEFAULT false) RETURNS text
2101 2101
    LANGUAGE sql IMMUTABLE
2102 2102
    AS $_$
2103 2103
/* debug_print_return_value() needed because this function is used with EXECUTE
2104 2104
rather than util.eval() (in order to affect the calling function), so the
2105 2105
search_path would not otherwise be printed */
2106
SELECT util.debug_print_return_value($$SET LOCAL search_path TO $$||$1)
2106
SELECT util.debug_print_return_value($$SET$$||util._if($2, ''::text, $$ LOCAL$$)
2107
||$$ search_path TO $$||$1)
2107 2108
$_$;
2108 2109

  
2109 2110

  

Also available in: Unified diff