--
-- tree_left/1
--
create or replace function tree_left(
  bit varying
) returns varbit as $$


-- Create a key less than or equal to that of any child of the
-- current key.

declare
  key      alias for $1;
begin
  if key is null then
    return 'X00'::varbit;
  else
    return key || 'X00'::varbit;
  end if;
end;$$ language plpgsql;