Revision 14372
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
2125 | 2125 |
|
2126 | 2126 |
|
2127 | 2127 |
-- |
2128 |
-- Name: derived_cols_remove(regclass); Type: FUNCTION; Schema: util; Owner: - |
|
2129 |
-- |
|
2130 |
|
|
2131 |
CREATE FUNCTION derived_cols_remove(table_ regclass) RETURNS void |
|
2132 |
LANGUAGE sql |
|
2133 |
AS $$ |
|
2134 |
-- in reverse dependency order so nothing cascades to other derived cols |
|
2135 |
SELECT util.drop_derived_col(def.col) |
|
2136 |
FROM util.in_reverse(ARRAY(SELECT util.derived_col_defs(table_))) def |
|
2137 |
; |
|
2138 |
SELECT NULL::void; -- don't fold away functions called in previous query |
|
2139 |
$$; |
|
2140 |
|
|
2141 |
|
|
2142 |
-- |
|
2143 |
-- Name: FUNCTION derived_cols_remove(table_ regclass); Type: COMMENT; Schema: util; Owner: - |
|
2144 |
-- |
|
2145 |
|
|
2146 |
COMMENT ON FUNCTION derived_cols_remove(table_ regclass) IS ' |
|
2147 |
allows derived columns to be re-created in a different order |
|
2148 |
|
|
2149 |
idempotent |
|
2150 |
'; |
|
2151 |
|
|
2152 |
|
|
2153 |
-- |
|
2128 | 2154 |
-- Name: derived_cols_repopulate(regclass); Type: FUNCTION; Schema: util; Owner: - |
2129 | 2155 |
-- |
2130 | 2156 |
|
Also available in: Unified diff
schemas/util.sql: added derived_cols_remove(), which allows derived columns to be re-created in a different order