Project

General

Profile

« Previous | Next » 

Revision 12261

schemas/vegbien.sql: added rematerialize_out_view(in_view regclass)

View differences:

vegbien.sql
1969 1969
';
1970 1970

  
1971 1971

  
1972
--
1973
-- Name: rematerialize_out_view(regclass, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
1974
--
1975

  
1976
CREATE FUNCTION rematerialize_out_view(in_view regclass, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS regclass
1977
    LANGUAGE plpgsql
1978
    AS $$
1979
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
1980
changes of search_path (schema elements are bound at inline time rather than
1981
runtime) */
1982
BEGIN
1983
	PERFORM set_config('search_path', util.schema_esc(schema_anchor), true);
1984
	
1985
	RETURN rematerialize_out_view(datasource_schema := util.schema(in_view),
1986
		out_view := util.qual_name(util.schema(schema_anchor),
1987
		util.name(in_view)));
1988
END;
1989
$$;
1990

  
1991

  
1992
--
1993
-- Name: FUNCTION rematerialize_out_view(in_view regclass, schema_anchor anyelement); Type: COMMENT; Schema: public_validations; Owner: -
1994
--
1995

  
1996
COMMENT ON FUNCTION rematerialize_out_view(in_view regclass, schema_anchor anyelement) IS '
1997
usage:
1998
SELECT public_validations.rematerialize_out_view(''datasource._view_name'') AS out_table;
1999

  
2000
idempotent, but repeats action each time
2001

  
2002
schema_anchor: identifies which schema to use. should be left as the default value.
2003
';
2004

  
2005

  
1972 2006
SET search_path = public, pg_catalog;
1973 2007

  
1974 2008
--

Also available in: Unified diff