-
Notifications
You must be signed in to change notification settings - Fork 58
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
Integer/Unsigned number no longer valid since 3.x+v2? #398
Comments
I don't remember any related changes in the At first glance it looks like the int64 values were passed successfully to Tarantool 3, but it decoded/applied them incorrectly (or not as we expect). It works fine for me with func TestInsertInt64(t *testing.T) {
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
defer conn.Close()
_, err := conn.Do(NewExecuteRequest("CREATE TABLE \"q\" (\"q\" INTEGER PRIMARY KEY);")).Get()
require.NoError(t, err)
row, err := conn.Do(NewInsertRequest("q").Tuple([]interface{}{int64(1717345988)})).Get()
require.NoError(t, err)
assert.Equal(t, []interface{}{[]interface{}{int64(1717345988)}}, row)
row, err = conn.Do(NewSelectRequest("q")).Get()
require.NoError(t, err)
assert.Equal(t, []interface{}{[]interface{}{int64(1717345988)}}, row)
} The patch for the `tarantool_test.go`diff --git a/tarantool_test.go b/tarantool_test.go
index 03b786f..466d3bf 100644
--- a/tarantool_test.go
+++ b/tarantool_test.go
@@ -848,6 +848,22 @@ func TestFutureMultipleGetGetTyped(t *testing.T) {
}
}
+func TestInsertInt64(t *testing.T) {
+ conn := test_helpers.ConnectWithValidation(t, dialer, opts)
+ defer conn.Close()
+
+ _, err := conn.Do(NewExecuteRequest("CREATE TABLE \"q\" (\"q\" INTEGER PRIMARY KEY);")).Get()
+ require.NoError(t, err)
+
+ row, err := conn.Do(NewInsertRequest("q").Tuple([]interface{}{int64(1717345988)})).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{int64(1717345988)}}, row)
+
+ row, err = conn.Do(NewSelectRequest("q")).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{int64(1717345988)}}, row)
+}
+
func TestFutureMultipleGetWithError(t *testing.T) {
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
defer conn.Close() The patch for the `tarantool_test.go` with another attemptdiff --git a/config.lua b/config.lua
index 2553b94..ba6e749 100644
--- a/config.lua
+++ b/config.lua
@@ -62,6 +62,16 @@ box.once("init", function()
if_not_exists = true
})
+ local s = box.schema.space.create('q', {
+ id = 1010,
+ if_not_exists = true,
+ })
+ s:create_index('primary', {
+ type = 'tree',
+ parts = {1, 'string'},
+ if_not_exists = true
+ })
+
local s = box.schema.space.create('testintint', {
id = 619,
if_not_exists = true,
diff --git a/tarantool_test.go b/tarantool_test.go
index 03b786f..a77f787 100644
--- a/tarantool_test.go
+++ b/tarantool_test.go
@@ -848,6 +848,19 @@ func TestFutureMultipleGetGetTyped(t *testing.T) {
}
}
+func TestInsertInt64(t *testing.T) {
+ conn := test_helpers.ConnectWithValidation(t, dialer, opts)
+ defer conn.Close()
+
+ row, err := conn.Do(NewInsertRequest("q").Tuple([]interface{}{"foo", int64(1717345988)})).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{"foo", int64(1717345988)}}, row)
+
+ row, err = conn.Do(NewSelectRequest("q")).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{"foo", int64(1717345988)}}, row)
+}
+
func TestFutureMultipleGetWithError(t *testing.T) {
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
defer conn.Close() What do you get in a response if you Please, provide the space format/the space creation code and the insert request code (or a reproducer) to make it easier for us to check the problem. Please, try to use |
Oh, I have the reproducer: diff --git a/config.lua b/config.lua
index 2553b94..4039119 100644
--- a/config.lua
+++ b/config.lua
@@ -62,6 +62,20 @@ box.once("init", function()
if_not_exists = true
})
+ local s = box.schema.space.create('q', {
+ id = 1010,
+ if_not_exists = true,
+ format = {
+ {name = "id", type = "string"},
+ {name = "age", type = "integer"},
+ },
+ })
+ s:create_index('primary', {
+ type = 'tree',
+ parts = {1, 'string'},
+ if_not_exists = true
+ })
+
local s = box.schema.space.create('testintint', {
id = 619,
if_not_exists = true,
diff --git a/tarantool_test.go b/tarantool_test.go
index 03b786f..c1b46c5 100644
--- a/tarantool_test.go
+++ b/tarantool_test.go
@@ -848,6 +848,25 @@ func TestFutureMultipleGetGetTyped(t *testing.T) {
}
}
+func TestInsertInt64(t *testing.T) {
+ conn := test_helpers.ConnectWithValidation(t, dialer, opts)
+ defer conn.Close()
+
+ row, err := conn.Do(NewInsertRequest("q").Tuple([]interface{}{"foo", int64(1717345988)})).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{"foo", int64(1717345988)}}, row)
+
+ row, err = conn.Do(NewSelectRequest("q")).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{"foo", int64(1717345988)}}, row)
+
+ row, err = conn.Do(NewExecuteRequest("SELECT * FROM seqscan q;")).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{"foo", int8(-28)}}, row)
+}
+
func TestFutureMultipleGetWithError(t *testing.T) {
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
defer conn.Close() It's funny. With the
With the tarantool console directly:
|
@kokizzu , could you confirm that values that you get with If so, the problem on the Tarantool 3 side somewhere in the SQL code or we pass an unexpected type (for the SQL code) by the connector. |
3.x
works fine |
It seems like a Tarantool's issue: I see two ways to make a workaround:
I'll re-open the issue again if we can get something done here. |
Previously this code inserting properly on tarantool 2.x + go-tarantool (v1)
but no longer work properly for tarantool 3.x + go-tarantool/v2
where input
arr
is:and output
row
is:but from terminal it's stored not as is:
for example that createdAt should be unix timestamp integer value but it's now stored as
-20
?The text was updated successfully, but these errors were encountered: