Add raster table calls, like the old function has

master
Paul Ramsey 9 years ago
parent b195aa4b68
commit 1a1f45cdad

@ -1432,6 +1432,7 @@ RETURNS void
AS $$
DECLARE
is_raster BOOLEAN;
relname TEXT;
relschema TEXT;
@ -1465,17 +1466,29 @@ BEGIN
-- Drop triggers first
PERFORM _CDB_drop_triggers(reloid);
-- Rewrite (or rename) the table to the new location
PERFORM _CDB_Rewrite_Table(reloid, destschema);
-- 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
PERFORM _CDB_Rewrite_Table(reloid, destschema);
-- The old regclass might not be valid anymore if we re-wrote the table...
destoid := (destschema || '.' || destname)::regclass;
-- 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 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);
-- Add triggers to the destination table, as necessary
PERFORM _CDB_create_triggers(destschema, destoid);
END IF;
END;
$$ LANGUAGE 'plpgsql';

Loading…
Cancel
Save