LightDB23.3 支持binary_float/binary_double
LightDB 从 23.3 版本开始在 oracl e模式下支持 oracle 的 binary_float 和 binary_double。都遵循IEEE754标准。
示例
lightdb@test_o=# create table t1(key1 binary_float);
CREATE TABLE
lightdb@test_o=# \d+ t1
Table "public.t1"
Column | Type | Collation | Nullable | Default | Storage | Sta
ts target | Description
--------+---------------+-----------+----------+---------+---------+----
----------+-------------
key1 | binary_float | | | | plain |
|
Access method: heap
lightdb@test_o=# insert into t1 values(123456789012345678901234567890123456789);
INSERT 0 1
lightdb@test_o=# insert into t1 values('infinity');
INSERT 0 1
lightdb@test_o=# insert into t1 values('NaN');
INSERT 0 1
lightdb@test_o=# select * from t1;
key1
---------------
1.2345679e+38
Infinity
NaN
(3 rows)
lightdb@test_o=# create table t1(key1 binary_double);
CREATE TABLE
lightdb@test_o=# \d+ t1
Table "public.t1"
Column | Type | Collation | Nullable | Default | Storage | Sta
ts target | Description
--------+---------------+-----------+----------+---------+---------+----
----------+-------------
key1 | binary_double | | | | plain |
|
Access method: heap
lightdb@test_o=# insert into t1 values(123456789012345678901234567890123456789);
INSERT 0 1
lightdb@test_o=# insert into t1 values('infinity');
INSERT 0 1
lightdb@test_o=# insert into t1 values('NaN');
INSERT 0 1
lightdb@test_o=# select * from t1;
key1
------------------------
1.2345678901234568e+38
Infinity
NaN
(3 rows)
Note
LightDB 的binary_float/binary_double 与oracle的binary_float/binary_double在内存中表示相同, 但查询出来的显示不同。
比如:123456789012345678901234567890123456789,在内存上表示的都是1.2345678605116651e+38,但oracle 显示为1.23456786E38,lightdb 显示为1.2345679e+38,精度不同。