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

SQL result header and column type mismatch #7295

Closed
msiomkin opened this issue Jun 22, 2022 · 0 comments · Fixed by #7349
Closed

SQL result header and column type mismatch #7295

msiomkin opened this issue Jun 22, 2022 · 0 comments · Fixed by #7349
Assignees
Labels
2.10 Target is 2.10 and all newer release/master branches bug Something isn't working sql

Comments

@msiomkin
Copy link
Contributor

msiomkin commented Jun 22, 2022

Bug description

The column data type in the result header doesn't match the actual data type

  • OS: Linux
  • OS Version: Centos 8
  • Architecture: amd64
Tarantool 2.11.0-entrypoint-109-ga6818accc
Target: Linux-x86_64-RelWithDebInfo
Build options: cmake . -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_BACKTRACE=ON
Compiler: /usr/lib64/ccache/cc /usr/lib64/ccache/c++
C_FLAGS: -fexceptions -funwind-tables -fno-common -fopenmp -msse2 -std=c11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-format-truncation -Wno-gnu-alignof-expression -fno-gnu89-inline -Wno-cast-function-type
CXX_FLAGS: -fexceptions -funwind-tables -fno-common -fopenmp -msse2 -std=c++11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-format-truncation -Wno-invalid-offsetof -Wno-gnu-alignof-expression -Wno-cast-function-type

Steps to reproduce

Scenario 1

Run tarantool. Run the following script:

box.cfg{}

test1 = box.schema.create_space("test1")

test1:format({
      { name = "id", type = "unsigned" },
      { name = "a", type = "unsigned" },
      { name = "b", type = "unsigned" }
})

test1:create_index("primary")

test1:insert({1, 1, 2})

box.execute([[
    select "a" - "b"
    from "test1"
]])

Actual behavior

---
- metadata:
  - name: COLUMN_1
    type: unsigned
  rows:
  - [-1]
...

Expected behavior

---
- metadata:
  - name: COLUMN_1
    type: integer
  rows:
  - [-1]
...

Scenario 2

Run tarantool. Run the following script:

box.cfg{}

test1 = box.schema.create_space("test1")

test1:format({
      { name = "id", type = "unsigned" },
      { name = "a", type = "unsigned" },
      { name = "b", type = "unsigned" }
})

test1:create_index("primary")

test1:insert({1, 1, 2})

box.execute([[
    select "a" - "b"
    from "test1"
    order by 1
    limit 1
]])

Actual behavior

---
- null
- 'Tuple field 1 (_COLUMN_0) type does not match one required by operation: expected
  unsigned, got integer'
...

Expected behavior

---
- metadata:
  - name: COLUMN_1
    type: integer
  rows:
  - [-1]
...
@msiomkin msiomkin added the bug Something isn't working label Jun 22, 2022
@ImeevMA ImeevMA self-assigned this Jul 4, 2022
ImeevMA added a commit to ImeevMA/tarantool that referenced this issue Jul 4, 2022
After this patch, the result type of arithmetic between two unsigned
values will be INTEGER.

Closes tarantool#7295

NO_DOC=bugfix
kyukhin pushed a commit that referenced this issue Jul 8, 2022
After this patch, the result type of arithmetic between two unsigned
values will be INTEGER.

Closes #7295

NO_DOC=bugfix
kyukhin pushed a commit that referenced this issue Jul 11, 2022
After this patch, the result type of arithmetic between two unsigned
values will be INTEGER.

Closes #7295

NO_DOC=bugfix

(cherry picked from commit 3715f63)
@igormunkin igormunkin added the 1sp label Jul 20, 2022
mkokryashkin pushed a commit to mkokryashkin/tarantool that referenced this issue Sep 9, 2022
After this patch, the result type of arithmetic between two unsigned
values will be INTEGER.

Closes tarantool#7295

NO_DOC=bugfix
@igormunkin igormunkin added 2.10 Target is 2.10 and all newer release/master branches and removed 1sp labels Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.10 Target is 2.10 and all newer release/master branches bug Something isn't working sql
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants