Replies: 7 comments 6 replies
-
What I found for other verdors after some experiments:
I think, that for for arithmetic operations rules similar to suggested:
I think, that for for arithmetic operations rules similar to suggested:
I think, that for for arithmetic operations rules similar to suggested: |
Beta Was this translation helpful? Give feedback.
-
Two years ago I indicated what I was expecting in #4415 "Implement DECIMAL data type". |
Beta Was this translation helpful? Give feedback.
-
Okay. There are several matters that I mentioned in that comment but I'll try to stay on your stated topic.
But we are already doing the right thing with INTEGER and DOUBLE:
Therefore I do not think this will be controversial.
This happens to be correct, but is not happening because DOUBLE has priority.
|
Beta Was this translation helpful? Give feedback.
-
For future reference here is excerpt from PostgreSQL documentation https://www.postgresql.org/docs/13/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS :
Their heuristics is pretty much as what we want to achieve, module their specific types which we do not have (e.g. |
Beta Was this translation helpful? Give feedback.
-
For me all the options looks fine. Can't say which one is much better or more correct. Only want to say that we must not use "decimal" for all numbers regardless of their value. Must try to use integer types where possible. Because most of the time I suppose it would be possible and much faster to work with. |
Beta Was this translation helpful? Give feedback.
-
i.e.
The idea here is - we still have consistent type promotion rules (which eventually may be extended with infinite decimal implementation like in PostgreSQL), but still have convenient for developer way to enforce Explicit and Implicit castsIt's already defined in original RFC. Essentially Please see below conversions table we agreed upon before, after #5910 discussion
We do not use implicit casts table for comparisons (see reasoning here) but meta-class NUMBER do actually use heuristics for numeric types, which is very similar to implicit casts between all numbers. i.e. |
Beta Was this translation helpful? Give feedback.
-
Numeric types in Tarantool SQL
IntroductionThis RFC describes:
Numeric types in Tarantool SQL.Currently Tarantool supports following numeric types:
Explicit and implicit cast from non-numeric type to numeric type.Rules of explicit and implicit cast are the same for cast from Explicit cast from
|
Beta Was this translation helpful? Give feedback.
-
Hi all! With addition of DECIMAL I would like to suggest rules for determining the type of number in the following cases:
The rules that I suggest:
Parsing:
Explicit or implicit cast to number (without specifying INTEGER, DECIMAL, or DOUBLE):
Arithmetic operations (after implicit cast to number):
So, in general we try to work with numbers with fixed point where possible.
Also, be aware that if these rules will have big impact on performance, they may change.
Beta Was this translation helpful? Give feedback.
All reactions