   destoid := (destschema || '.' || destname)::regclass;
 
   -- Add indexes to the destination table, as necessary
-  SELECT _CDB_Add_Indexes(destoid, geom_name, mercgeom_name, primary_key_name)
+  SELECT _CDB_Add_Indexes(destoid)
   INTO STRICT index_success;
 
   IF NOT index_success THEN
-    RAISE EXCEPTION 'Cartodbfying % (indexing table): % (%)', destoid, SQLERRM, SQLSTATE;
+    PERFORM _CDB_Error('indexing table', 'CDB_CartodbfyTable2');
   END IF;
   
   -- Add triggers to the destination table, as necessary

  rewrite BOOLEAN;
  index_success BOOLEAN;
  rec RECORD;
BEGIN

  -- Save the raw schema/table names for later


  -- Add cartodb ID!
  IF has_usable_primary_key THEN
    sql := sql || const.pkey;
  ELSE
    sql := sql || 'nextval(''' || destseq || ''') AS ' || const.pkey;
  END IF;

  -- Add the geometry columns!
  IF has_usable_geoms THEN
    sql := sql || ',' || const.geomcol || ',' || const.mercgeomcol;
  ELSE
    
    -- This gets complicated: we have to make sure the 
