Add raster table calls, like the old function has

This commit is contained in:
Paul Ramsey
2015-08-11 05:40:31 -07:00
parent b195aa4b68
commit 1a1f45cdad
+21 -8
View File
@@ -1432,6 +1432,7 @@ RETURNS void
AS $$ AS $$
DECLARE DECLARE
is_raster BOOLEAN;
relname TEXT; relname TEXT;
relschema TEXT; relschema TEXT;
@@ -1465,17 +1466,29 @@ BEGIN
-- Drop triggers first -- Drop triggers first
PERFORM _CDB_drop_triggers(reloid); PERFORM _CDB_drop_triggers(reloid);
-- Rewrite (or rename) the table to the new location -- Rasters only get a cartodb_id and a limited selection of triggers
PERFORM _CDB_Rewrite_Table(reloid, destschema); -- 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
-- The old regclass might not be valid anymore if we re-wrote the table... PERFORM cartodb._CDB_create_cartodb_id_column(reloid);
destoid := (destschema || '.' || destname)::regclass; PERFORM cartodb._CDB_create_raster_triggers(destschema, reloid);
-- Add indexes to the destination table, as necessary ELSE
PERFORM _CDB_Add_Indexes(destoid);
-- Add triggers to the destination table, as necessary -- Rewrite (or rename) the table to the new location
PERFORM _CDB_create_triggers(destschema, destoid); PERFORM _CDB_Rewrite_Table(reloid, destschema);
-- The old regclass might not be valid anymore if we re-wrote the table...
destoid := (destschema || '.' || destname)::regclass;
-- Add indexes to the destination table, as necessary
PERFORM _CDB_Add_Indexes(destoid);
-- Add triggers to the destination table, as necessary
PERFORM _CDB_create_triggers(destschema, destoid);
END IF;
END; END;
$$ LANGUAGE 'plpgsql'; $$ LANGUAGE 'plpgsql';