BEGIN;
CREATE FUNCTION f () RETURNS boolean AS '
DECLARE
  i RECORD;
BEGIN
  FOR i IN SELECT relname FROM pg_class WHERE relkind = \'r\' AND relname LIKE \'_%_data\' LOOP
    EXECUTE \'UPDATE \' || i.relname || \' SET _start_t=\\\'1970/1/1 00:00:00 UTC\\\' WHERE _start_t IS NULL\';
  END LOOP;
  RETURN true;
END;
' LANGUAGE 'plpgsql';
SELECT f();
DROP FUNCTION f();
COMMIT;
