tarantool / tarantool/doc

Describe SQL CASE operation

Open
#3,202 0 comments 0 reactions 1 assignee View on GitHub

@p7nov is already working on this.

Since Aug 30, 2023.

2.10 2.11 add details reference sql
Dominant language
CSS
Stars
15
Forks
49
Avg merge
1d 13h
Merged PRs (30d)
3

Description

dev issue/commit: https://github.com/tarantool/tarantool/commit/5585825a200e40d1a2c45ec09c81f2daceea34d4

Product: Tarantool
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_sql/sql-features/#f261-case-expression
https://www.tarantool.io/en/doc/latest/reference/reference_sql/sql_statements_and_clauses
SME: @ ImeevMA
Estimation:

Connected with #2825

Details

TBD

Update from #3184

New rules are applied to determine the type of the CASE operation. If
all values are NULL with no type, or if a bind variable exists among
the possible results, then the type of CASE is ANY. Otherwise, all NULL
values with no type are ignored, and the type of CASE is determined
using the following rules:

  1. if all values of the same type, then type of CASE is this type;
  2. otherwise, if any of the possible results is of one of the
    incomparable types, then the type of CASE is ANY;
  3. otherwise, if any of the possible results is of one of the
    non-numeric types, then the type of CASE is SCALAR;
  4. otherwise, if any of the possible results is of type NUMBER, then the
    type of CASE is NUMBER;
  5. otherwise, if any of the possible results is of type DECIMAL, then
    the type of CASE is DECIMAL;
  6. otherwise, if any of the possible results is of type DOUBLE, then the
    type of CASE is DOUBLE;
  7. otherwise the type of CASE is INTEGER.
    Requested by @ ImeevMA in https://github.com/tarantool/tarantool/commit/90f6446046809c660f8fed71712f19315ae40d9a.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.