--
-- timezone__get_abbrev/2
--
create or replace function timezone__get_abbrev(
  p_tz_id integer,
  p_time timestamp with time zone
) returns varchar as $$

DECLARE
  v_abbrev timezone_rules.abbrev%TYPE;
BEGIN
  v_abbrev := 'GMT';

  select abbrev into v_abbrev
  from   timezone_rules
  where  tz_id = p_tz_id and p_time between local_start and local_end;
	 
  return v_abbrev;
END;
$$ language plpgsql;