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
sql: define rules for comparison for SCALAR #5148
Comments
But the rules are defined. In box. And I don't see why should they be different in SQL, it would be inconsistent, and would lead to different results when you select using box and using SQL. |
@pgulutzan Could you say you agree or disagree with these rules? |
I agree with the box rules, which are in the manual https://www.tarantool.io/en/doc/2.4/reference/reference_lua/box_space/#lua-function.space_object.create_index:
restated in the SQL section:
In issue#4783 comment @ImeevMA said:
I do not agree that there should be a "value of SCALAR type". |
@pgulutzan Do you mean that we use the mentioned rules only if we search in a column of type SCALAR? |
No, I mean that I believe we should use the mentioned rules always. |
@pgulutzan What do you think of the idea of making SCALAR a completely separate type? I mean, in this case, we must cast the values to SCALAR ( So far this is just an idea. But we can do it if it's worth it. |
@ImeevMA: I do not like this. As I said in old emails, CREATE TABLE t (s1 SCALAR PRIMARY KEY);
INSERT INTO t VALUES (1),('a');
SELECT * FROM t WHERE s1 = 'a'; ... will fail because you cannot compare 'a' to SELECT * FROM t WHERE CAST(s1 AS STRING) = 'a'; ... will fail because you cannot cast 1 to |
@pgulutzan, this was originally my idea. I am personally don't like any kinds of VARIANT type in strictly typed language and that is why I am trying to limit SCALAR. I don't understand, how can we deal with different types in a single column of a table. CREATE TABLE t (s1 SCALAR PRIMARY KEY);
INSERT INTO t VALUES (1),('a');
SELECT * FROM t WHERE s1 = 'a'; Should we try to compare integer (1) to 'a'? Once again I am against of implicit casting. |
All values in the SCALAR field are divided into 8 classes, between the values of different classes the comparison is performed as a comparison between classes:
For example:
|
@kyukhin: I have argued about this several times in dev emails, for example |
Rules defined as part of #6009 |
We should define rules for comparison between value of SCALAR type and value of any of scalar types (INTEGER, STRING, BOOLEAN, DOUBLE, VARBINARY, NUMBER).
The text was updated successfully, but these errors were encountered: