On 26/12/2019 16:43, Mark Rotteveel wrote:
Formally, I take this to mean we should choose one type, eg DECIMAL, but
that would probably not match people assuming that literal without
decimal points are integral literals.
We could consider a middle ground where literals without decimal point
with 18 or less digits are BIGINT, that longer literals are DECIMAL, and
that literals with decimal point are DECIMAL.
On a related note, I just noticed that exact numeric literals with more
than 19 digits have a subtype that is equal to the length of the literal
(digits + decimal point).
Eg:
"""
SET SQLDA_DISPLAY ON;
SQL> select 123456789012345678.90 from rdb$database;
INPUT message field count: 0
OUTPUT message field count: 1
01: sqltype: 32752 NUMERIC(38) scale: -2 subtype: 21 len: 16
: name: CONSTANT alias: CONSTANT
: table: owner:
CONSTANT
=============================================
123456789012345678.90
SQL> select 123456789012345678.901 from rdb$database;
INPUT message field count: 0
OUTPUT message field count: 1
01: sqltype: 32752 NUMERIC(38) scale: -3 subtype: 22 len: 16
: name: CONSTANT alias: CONSTANT
: table: owner:
CONSTANT
=============================================
123456789012345678.901
SQL> select 123456789012345678901 from rdb$database;
INPUT message field count: 0
OUTPUT message field count: 1
01: sqltype: 32752 NUMERIC(38) scale: 0 subtype: 21 len: 16
: name: CONSTANT alias: CONSTANT
: table: owner:
CONSTANT
=============================================
123456789012345678901
"""
Why is that? I would expect either subtype 0 (like literals of 19 or
less digits), or otherwise subtype 1 or 2.
Mark
--
Mark Rotteveel
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel