Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make explicit basic type for high precision numerics - INT128 [CORE6342] #6583

Closed
firebird-automations opened this issue Jun 24, 2020 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @AlexPeshkoff

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.

Commits: 137c3a9 150c293 FirebirdSQL/fbt-repository@98ff3ac FirebirdSQL/fbt-repository@06eab42 FirebirdSQL/fbt-repository@2d37260 FirebirdSQL/fbt-repository@157c6c2 FirebirdSQL/fbt-repository@e6fea11 FirebirdSQL/fbt-repository@262cffa FirebirdSQL/fbt-repository@699613c FirebirdSQL/fbt-repository@0cf16b9 FirebirdSQL/fbt-repository@5e5c7d8

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 RC 1 [ 10930 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @livius2

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 ..

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

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).

@firebird-automations
Copy link
Collaborator Author

Commented by: @livius2

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.

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

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.

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

create domain dm_128_c as int128 default -9223372036854775808;

Output:

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: CORE6291, the same for bigint ( no such problem with default value = -9223372036854775807 )

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants