Revision 12292
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/schemas/util.sql | ||
---|---|---|
1010 | 1010 |
|
1011 | 1011 |
|
1012 | 1012 |
-- |
1013 |
-- Name: drop_column(col_ref); Type: FUNCTION; Schema: util; Owner: - |
|
1013 |
-- Name: drop_column(col_ref, boolean); Type: FUNCTION; Schema: util; Owner: -
|
|
1014 | 1014 |
-- |
1015 | 1015 |
|
1016 |
CREATE FUNCTION drop_column(col col_ref) RETURNS void |
|
1016 |
CREATE FUNCTION drop_column(col col_ref, force boolean DEFAULT false) RETURNS void
|
|
1017 | 1017 |
LANGUAGE sql STRICT |
1018 | 1018 |
AS $_$ |
1019 | 1019 |
SELECT util.eval($$ALTER TABLE $$||$1.table_||$$ DROP COLUMN IF EXISTS $$|| |
1020 |
quote_ident($1.name)) |
|
1020 |
quote_ident($1.name)||util._if($2, $$ CASCADE$$, ''::text))
|
|
1021 | 1021 |
$_$; |
1022 | 1022 |
|
1023 | 1023 |
|
1024 | 1024 |
-- |
1025 |
-- Name: FUNCTION drop_column(col col_ref); Type: COMMENT; Schema: util; Owner: - |
|
1025 |
-- Name: FUNCTION drop_column(col col_ref, force boolean); Type: COMMENT; Schema: util; Owner: -
|
|
1026 | 1026 |
-- |
1027 | 1027 |
|
1028 |
COMMENT ON FUNCTION drop_column(col col_ref) IS ' |
|
1028 |
COMMENT ON FUNCTION drop_column(col col_ref, force boolean) IS '
|
|
1029 | 1029 |
idempotent |
1030 | 1030 |
'; |
1031 | 1031 |
|
1032 | 1032 |
|
1033 | 1033 |
-- |
1034 |
-- Name: drop_table(text); Type: FUNCTION; Schema: util; Owner: - |
|
1034 |
-- Name: drop_table(text, boolean); Type: FUNCTION; Schema: util; Owner: -
|
|
1035 | 1035 |
-- |
1036 | 1036 |
|
1037 |
CREATE FUNCTION drop_table(table_ text) RETURNS void |
|
1037 |
CREATE FUNCTION drop_table(table_ text, force boolean DEFAULT false) RETURNS void
|
|
1038 | 1038 |
LANGUAGE sql STRICT |
1039 | 1039 |
AS $_$ |
1040 |
SELECT util.eval($$DROP TABLE IF EXISTS $$||$1) |
|
1040 |
SELECT util.eval($$DROP TABLE IF EXISTS $$||$1 |
|
1041 |
||util._if($2, $$ CASCADE$$, ''::text)) |
|
1041 | 1042 |
$_$; |
1042 | 1043 |
|
1043 | 1044 |
|
1044 | 1045 |
-- |
1045 |
-- Name: FUNCTION drop_table(table_ text); Type: COMMENT; Schema: util; Owner: - |
|
1046 |
-- Name: FUNCTION drop_table(table_ text, force boolean); Type: COMMENT; Schema: util; Owner: -
|
|
1046 | 1047 |
-- |
1047 | 1048 |
|
1048 |
COMMENT ON FUNCTION drop_table(table_ text) IS ' |
|
1049 |
COMMENT ON FUNCTION drop_table(table_ text, force boolean) IS '
|
|
1049 | 1050 |
idempotent |
1050 | 1051 |
'; |
1051 | 1052 |
|
1052 | 1053 |
|
1053 | 1054 |
-- |
1054 |
-- Name: drop_view(text); Type: FUNCTION; Schema: util; Owner: - |
|
1055 |
-- Name: drop_view(text, boolean); Type: FUNCTION; Schema: util; Owner: -
|
|
1055 | 1056 |
-- |
1056 | 1057 |
|
1057 |
CREATE FUNCTION drop_view(view_ text) RETURNS void |
|
1058 |
CREATE FUNCTION drop_view(view_ text, force boolean DEFAULT false) RETURNS void
|
|
1058 | 1059 |
LANGUAGE sql STRICT |
1059 | 1060 |
AS $_$ |
1060 |
SELECT util.eval($$DROP VIEW IF EXISTS $$||$1) |
|
1061 |
SELECT util.eval($$DROP VIEW IF EXISTS $$||$1 |
|
1062 |
||util._if($2, $$ CASCADE$$, ''::text)) |
|
1061 | 1063 |
$_$; |
1062 | 1064 |
|
1063 | 1065 |
|
1064 | 1066 |
-- |
1065 |
-- Name: FUNCTION drop_view(view_ text); Type: COMMENT; Schema: util; Owner: - |
|
1067 |
-- Name: FUNCTION drop_view(view_ text, force boolean); Type: COMMENT; Schema: util; Owner: -
|
|
1066 | 1068 |
-- |
1067 | 1069 |
|
1068 |
COMMENT ON FUNCTION drop_view(view_ text) IS ' |
|
1070 |
COMMENT ON FUNCTION drop_view(view_ text, force boolean) IS '
|
|
1069 | 1071 |
idempotent |
1070 | 1072 |
'; |
1071 | 1073 |
|
Also available in: Unified diff
schemas/util.sql: drop_*(): added force param to use CASCADE mode