Issue Details (XML | Word | Printable)

Key: CORE-6342
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Alexander Peshkov
Votes: 0
Watchers: 3

If you were logged in you would be able to see more operations.
Firebird Core

Make explicit basic type for high precision numerics - INT128

Created: 24/Jun/20 10:05 AM   Updated: 24/Jun/20 08:56 PM
Component/s: API / Client Library, Engine
Affects Version/s: None
Fix Version/s: 4.0 RC 1

QA Status: Done successfully

 Description  « Hide
Hiding basic datatype under subtypes (numeric/decimal) causes too many problems here and there. It's better to have support for such datatype in SQL.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Karol Bieniaszewski added a comment - 24/Jun/20 10:50 AM
Is it possible to have also:

int32 as alternative to Integer
int64 as alternative to bigint

because now bigint name is inappropriate
This will be good for future extensions int32, int64, int128, int256, int512 ..

Mark Rotteveel added a comment - 24/Jun/20 02:02 PM
 Introducing a non-standard INT128 is fine, but I don't think aliasing the names defined in the SQL standard is a good idea, that only introduces more clutter for little to no real benefit (other than naming consistency).

Karol Bieniaszewski added a comment - 24/Jun/20 02:44 PM
I suppose that this become standard.
What name for int128 in sql standard and then int256 int512 ...
And this aliases are good also for migration from some databases. In Ingres there is int32.

Mark Rotteveel added a comment - 24/Jun/20 04:08 PM
It doesn't, the SQL standard defines TINYINT (which Firebird doesn't have), SMALLINT, INT/INTEGER* and BIGINT. It doesn't even define the sizes just that TINYINT < SMALLINT < INT < BIGINT. In that vein of naming, you could use HUGEINT, but that would be non-standard as well, so just settling for INT128 is non-ambiguous.

*: I'm not entirely sure if the standard defines both INT and INTEGER or just one of them, and I don't have my copy of SQL:2016 on my current machine.

Pavel Zotov added a comment - 24/Jun/20 08:31 PM
create domain dm_128_c as int128 default -9223372036854775808;

Statement failed, SQLSTATE = 22003
unsuccessful metadata update
-CREATE DOMAIN DM_128_C failed
-Dynamic SQL Error
-SQL error code = -104
-arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range

// see also: CORE-6291, the same for bigint ( no such problem with default value = -9223372036854775807 )

create domain dom06_13 as numeric(20,2) default -9999999999999999991; -- CORE-6294
-- works OK.