Project

General

Profile

« Previous | Next » 

Revision 12331

schemas/util.sql: added drop_relation()

View differences:

util.sql
1046 1046

  
1047 1047

  
1048 1048
--
1049
-- Name: drop_relation(regclass, boolean); Type: FUNCTION; Schema: util; Owner: -
1050
--
1051

  
1052
CREATE FUNCTION drop_relation(relation regclass, force boolean DEFAULT false) RETURNS void
1053
    LANGUAGE sql
1054
    AS $_$
1055
SELECT (CASE
1056
WHEN util.is_table($1) THEN util.drop_table($1::text)
1057
WHEN util.is_view($1)  THEN util.drop_view($1::text)
1058
-- otherwise, throw case_not_found error
1059
END)
1060
$_$;
1061

  
1062

  
1063
--
1064
-- Name: FUNCTION drop_relation(relation regclass, force boolean); Type: COMMENT; Schema: util; Owner: -
1065
--
1066

  
1067
COMMENT ON FUNCTION drop_relation(relation regclass, force boolean) IS '
1068
idempotent
1069
';
1070

  
1071

  
1072
--
1049 1073
-- Name: drop_table(text, boolean); Type: FUNCTION; Schema: util; Owner: -
1050 1074
--
1051 1075

  

Also available in: Unified diff