From c21fcdf69a29d7363ee8c667d5c3f5503b0600d6 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 29 Jun 2016 20:01:40 +0200 Subject: [PATCH] Drop objects in reverse order in downgrade script Otherwise it fails downgrading, despite it is supposed to run everything in the context of a transaction: ``` tests=# alter extension crankshaft update to '0.0.4'; ERROR: cannot drop function cdb_pyaggs(numeric[],numeric[]) because other objects depend on it DETAIL: extension crankshaft depends on function cdb_pyaggs(numeric[],numeric[]) HINT: Use DROP ... CASCADE to drop the dependent objects too. ``` --- release/crankshaft--0.1.0--0.0.4.sql | 112 +++++++++++++-------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/release/crankshaft--0.1.0--0.0.4.sql b/release/crankshaft--0.1.0--0.0.4.sql index 01bb059..983dbce 100644 --- a/release/crankshaft--0.1.0--0.0.4.sql +++ b/release/crankshaft--0.1.0--0.0.4.sql @@ -3,8 +3,6 @@ -- Complain if script is sourced in psql, rather than via CREATE EXTENSION \echo Use "CREATE EXTENSION crankshaft" to load this file. \quit --------------------------------------------------------------------------------- - -- Version number of the extension release CREATE OR REPLACE FUNCTION cdb_crankshaft_version() RETURNS text AS $$ @@ -13,60 +11,6 @@ $$ language 'sql' STABLE STRICT; -------------------------------------------------------------------------------- --- PyAgg stuff -DROP FUNCTION CDB_PyAggS(Numeric[], Numeric[]); -DROP AGGREGATE CDB_PyAgg(NUMERIC[]); - --------------------------------------------------------------------------------- - --- Segmentation stuff - -DROP FUNCTION - CDB_CreateAndPredictSegment( - target NUMERIC[], - features NUMERIC[], - target_features NUMERIC[], - target_ids NUMERIC[], - n_estimators INTEGER, - max_depth INTEGER, - subsample DOUBLE PRECISION, - learning_rate DOUBLE PRECISION, - min_samples_leaf INTEGER); - -DROP FUNCTION - CDB_CreateAndPredictSegment ( - query TEXT, - variable_name TEXT, - target_table TEXT, - n_estimators INTEGER, - max_depth INTEGER, - subsample DOUBLE PRECISION, - learning_rate DOUBLE PRECISION, - min_samples_leaf INTEGER); - --------------------------------------------------------------------------------- - --- Spatial interpolation - -DROP FUNCTION CDB_SpatialInterpolation( - IN query text, - IN point geometry, - IN method integer, - IN p1 numeric, - IN p2 numeric - ); - -DROP FUNCTION CDB_SpatialInterpolation( - IN geomin geometry[], - IN colin numeric[], - IN point geometry, - IN method integer, - IN p1 numeric, - IN p2 numeric - ); - --------------------------------------------------------------------------------- - -- Spatial Markov DROP FUNCTION @@ -79,3 +23,59 @@ DROP FUNCTION permutations INT, geom_col TEXT, id_col TEXT); + + +-------------------------------------------------------------------------------- + +-- Spatial interpolation + +DROP FUNCTION CDB_SpatialInterpolation( + IN geomin geometry[], + IN colin numeric[], + IN point geometry, + IN method integer, + IN p1 numeric, + IN p2 numeric + ); + +DROP FUNCTION CDB_SpatialInterpolation( + IN query text, + IN point geometry, + IN method integer, + IN p1 numeric, + IN p2 numeric + ); + +-------------------------------------------------------------------------------- + +-- Segmentation stuff + +DROP FUNCTION + CDB_CreateAndPredictSegment ( + query TEXT, + variable_name TEXT, + target_table TEXT, + n_estimators INTEGER, + max_depth INTEGER, + subsample DOUBLE PRECISION, + learning_rate DOUBLE PRECISION, + min_samples_leaf INTEGER); + +DROP FUNCTION + CDB_CreateAndPredictSegment( + target NUMERIC[], + features NUMERIC[], + target_features NUMERIC[], + target_ids NUMERIC[], + n_estimators INTEGER, + max_depth INTEGER, + subsample DOUBLE PRECISION, + learning_rate DOUBLE PRECISION, + min_samples_leaf INTEGER); + +-------------------------------------------------------------------------------- + +-- PyAgg stuff + +DROP AGGREGATE CDB_PyAgg(NUMERIC[]); +DROP FUNCTION CDB_PyAggS(Numeric[], Numeric[]); \ No newline at end of file