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

DECLARE
  v_isdst_p boolean;
BEGIN
  v_isdst_p := 'f';

  select isdst_p into v_isdst_p
  from   timezone_rules
  where  tz_id = p_tz_id and p_time between local_start and local_end;

  return v_isdst_p;
END;
$$ language plpgsql;