Revision 12133
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/schemas/util.sql | ||
---|---|---|
1909 | 1909 |
|
1910 | 1910 |
|
1911 | 1911 |
-- |
1912 |
-- Name: schema_replace(text, text); Type: FUNCTION; Schema: util; Owner: - |
|
1913 |
-- |
|
1914 |
|
|
1915 |
CREATE FUNCTION schema_replace(replace text, with_ text) RETURNS void |
|
1916 |
LANGUAGE plpgsql |
|
1917 |
AS $$ |
|
1918 |
BEGIN |
|
1919 |
-- don't schema_rm() the schema to keep! |
|
1920 |
IF replace = with_ THEN RETURN; END IF; |
|
1921 |
|
|
1922 |
PERFORM util.schema_rm(replace); |
|
1923 |
PERFORM util.schema_rename(with_, replace); |
|
1924 |
END; |
|
1925 |
$$; |
|
1926 |
|
|
1927 |
|
|
1928 |
-- |
|
1912 | 1929 |
-- Name: schema_rm(text); Type: FUNCTION; Schema: util; Owner: - |
1913 | 1930 |
-- |
1914 | 1931 |
|
Also available in: Unified diff
schemas/util.sql: added schema_replace()