Revision 13525
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
3097 | 3097 |
|
3098 | 3098 |
|
3099 | 3099 |
-- |
3100 |
-- Name: recreate_view(regclass, text, text); Type: FUNCTION; Schema: util; Owner: - |
|
3101 |
-- |
|
3102 |
|
|
3103 |
CREATE FUNCTION recreate_view(view_ regclass, view_query text, dependent_view_changes text DEFAULT ''::text) RETURNS void |
|
3104 |
LANGUAGE sql |
|
3105 |
AS $_$ |
|
3106 |
SELECT util.recreate($$ |
|
3107 |
CREATE VIEW $$||$1||$$ AS |
|
3108 |
$$||$2||$$ |
|
3109 |
; |
|
3110 |
$$||util.mk_set_relation_metadata($1)||$$ |
|
3111 |
|
|
3112 |
-- manually restore views that need to be updated for the changes |
|
3113 |
$$||$3||$$ |
|
3114 |
$$); |
|
3115 |
$_$; |
|
3116 |
|
|
3117 |
|
|
3118 |
-- |
|
3119 |
-- Name: FUNCTION recreate_view(view_ regclass, view_query text, dependent_view_changes text); Type: COMMENT; Schema: util; Owner: - |
|
3120 |
-- |
|
3121 |
|
|
3122 |
COMMENT ON FUNCTION recreate_view(view_ regclass, view_query text, dependent_view_changes text) IS ' |
|
3123 |
usage: |
|
3124 |
SELECT util.recreate_view(''schema.main_view'', $$ |
|
3125 |
SELECT __ |
|
3126 |
$$, $$ |
|
3127 |
CREATE VIEW schema.dependent_view AS |
|
3128 |
__; |
|
3129 |
$$||util.mk_set_relation_metadata(''schema.dependent_view'')||$$ |
|
3130 |
$$); |
|
3131 |
|
|
3132 |
idempotent |
|
3133 |
'; |
|
3134 |
|
|
3135 |
|
|
3136 |
-- |
|
3100 | 3137 |
-- Name: regexp_match(text, text); Type: FUNCTION; Schema: util; Owner: - |
3101 | 3138 |
-- |
3102 | 3139 |
|
Also available in: Unified diff
schemas/util.sql: added recreate_view(), a special case of util.recreate()