Add raster table calls, like the old function has
This commit is contained in:
@@ -1432,6 +1432,7 @@ RETURNS void
|
|||||||
AS $$
|
AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
|
|
||||||
|
is_raster BOOLEAN;
|
||||||
relname TEXT;
|
relname TEXT;
|
||||||
relschema TEXT;
|
relschema TEXT;
|
||||||
|
|
||||||
@@ -1464,18 +1465,30 @@ BEGIN
|
|||||||
|
|
||||||
-- Drop triggers first
|
-- Drop triggers first
|
||||||
PERFORM _CDB_drop_triggers(reloid);
|
PERFORM _CDB_drop_triggers(reloid);
|
||||||
|
|
||||||
|
-- Rasters only get a cartodb_id and a limited selection of triggers
|
||||||
|
-- underlying assumption is that they are already formed up correctly
|
||||||
|
SELECT cartodb._CDB_is_raster_table(destschema, reloid) INTO is_raster;
|
||||||
|
IF is_raster THEN
|
||||||
|
|
||||||
|
PERFORM cartodb._CDB_create_cartodb_id_column(reloid);
|
||||||
|
PERFORM cartodb._CDB_create_raster_triggers(destschema, reloid);
|
||||||
|
|
||||||
|
ELSE
|
||||||
|
|
||||||
-- Rewrite (or rename) the table to the new location
|
-- Rewrite (or rename) the table to the new location
|
||||||
PERFORM _CDB_Rewrite_Table(reloid, destschema);
|
PERFORM _CDB_Rewrite_Table(reloid, destschema);
|
||||||
|
|
||||||
-- The old regclass might not be valid anymore if we re-wrote the table...
|
-- The old regclass might not be valid anymore if we re-wrote the table...
|
||||||
destoid := (destschema || '.' || destname)::regclass;
|
destoid := (destschema || '.' || destname)::regclass;
|
||||||
|
|
||||||
-- Add indexes to the destination table, as necessary
|
-- Add indexes to the destination table, as necessary
|
||||||
PERFORM _CDB_Add_Indexes(destoid);
|
PERFORM _CDB_Add_Indexes(destoid);
|
||||||
|
|
||||||
-- Add triggers to the destination table, as necessary
|
-- Add triggers to the destination table, as necessary
|
||||||
PERFORM _CDB_create_triggers(destschema, destoid);
|
PERFORM _CDB_create_triggers(destschema, destoid);
|
||||||
|
|
||||||
|
END IF;
|
||||||
|
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE 'plpgsql';
|
$$ LANGUAGE 'plpgsql';
|
||||||
|
|||||||
Reference in New Issue
Block a user