|
@@ -959,7 +959,7 @@ range_type_test(Module) ->
|
|
Module,
|
|
Module,
|
|
9.2,
|
|
9.2,
|
|
fun(_C) ->
|
|
fun(_C) ->
|
|
- check_type(Module, int4range, "int4range(10, 20)", <<"[10,20)">>,
|
|
|
|
|
|
+ check_type(Module, int4range, "int4range(10, 20)", {10, 20},
|
|
[{1, 58}, {-1, 12}, {-985521, 5412687}, {minus_infinity, 0},
|
|
[{1, 58}, {-1, 12}, {-985521, 5412687}, {minus_infinity, 0},
|
|
{984655, plus_infinity}, {minus_infinity, plus_infinity}])
|
|
{984655, plus_infinity}, {minus_infinity, plus_infinity}])
|
|
end,
|
|
end,
|
|
@@ -970,7 +970,7 @@ range8_type_test(Module) ->
|
|
Module,
|
|
Module,
|
|
9.2,
|
|
9.2,
|
|
fun(_C) ->
|
|
fun(_C) ->
|
|
- check_type(Module, int8range, "int8range(10, 20)", <<"[10,20)">>,
|
|
|
|
|
|
+ check_type(Module, int8range, "int8range(10, 20)", {10, 20},
|
|
[{1, 58}, {-1, 12}, {-985521, 5412687}, {minus_infinity, 0},
|
|
[{1, 58}, {-1, 12}, {-985521, 5412687}, {minus_infinity, 0},
|
|
{984655, plus_infinity}, {minus_infinity, plus_infinity}])
|
|
{984655, plus_infinity}, {minus_infinity, plus_infinity}])
|
|
end,
|
|
end,
|
|
@@ -1120,25 +1120,8 @@ compare(Type, V1 = {_, _, MS}, {D2, {H2, M2, S2}}) when Type == timestamp;
|
|
Type == timestamptz ->
|
|
Type == timestamptz ->
|
|
{D1, {H1, M1, S1}} = calendar:now_to_universal_time(V1),
|
|
{D1, {H1, M1, S1}} = calendar:now_to_universal_time(V1),
|
|
({D1, H1, M1} =:= {D2, H2, M2}) and (abs(S1 + MS/1000000 - S2) < 0.000000000000001);
|
|
({D1, H1, M1} =:= {D2, H2, M2}) and (abs(S1 + MS/1000000 - S2) < 0.000000000000001);
|
|
-compare(int4range, {Lower, Upper}, Result) ->
|
|
|
|
- translate_infinities(Lower, Upper) =:= Result;
|
|
|
|
-compare(int8range, {Lower, Upper}, Result) ->
|
|
|
|
- translate_infinities(Lower, Upper) =:= Result;
|
|
|
|
compare(_Type, V1, V2) -> V1 =:= V2.
|
|
compare(_Type, V1, V2) -> V1 =:= V2.
|
|
|
|
|
|
-translate_infinities(Lower, Upper) ->
|
|
|
|
- iolist_to_binary([lower(Lower), [","], upper(Upper)]).
|
|
|
|
-
|
|
|
|
-lower(minus_infinity) ->
|
|
|
|
- "(";
|
|
|
|
-lower(Val) ->
|
|
|
|
- io_lib:format("[~p", [Val]).
|
|
|
|
-
|
|
|
|
-upper(plus_infinity) ->
|
|
|
|
- ")";
|
|
|
|
-upper(Val) ->
|
|
|
|
- io_lib:format("~p)", [Val]).
|
|
|
|
-
|
|
|
|
format_hstore({Hstore}) -> Hstore;
|
|
format_hstore({Hstore}) -> Hstore;
|
|
format_hstore(Hstore) ->
|
|
format_hstore(Hstore) ->
|
|
[{format_hstore_key(Key), format_hstore_value(Value)} || {Key, Value} <- Hstore].
|
|
[{format_hstore_key(Key), format_hstore_value(Value)} || {Key, Value} <- Hstore].
|