 CREATE OR REPLACE FUNCTION OBS_GetAvailableBoundaries(
   geom geometry,
   time_span text DEFAULT null)
-RETURNS TABLE(description text, name text, id text)  as $$
+RETURNS TABLE(boundary_id text, description text, time_span text, tablename text)  as $$
 DECLARE
   timespan_query TEXT DEFAULT '';
 BEGIN

  EXECUTE
  $string$
      select
        column_id,
        obs_column.description,
        table_id
      FROM
        observatory.OBS_table,
        observatory.OBS_column_table,
        observatory.OBS_column
      WHERE
        observatory.OBS_column_table.column_id = observatory.obs_column.id
      AND
        observatory.OBS_column.type='Geometry'
      AND


  RETURN QUERY
  EXECUTE format($string$
              SELECT id, description,
                name,
                  aggregate,
                  replace(split_part(id,'".', 1),'"', '') source
