Skip to content

SQL: new rules to determine type of result of CASE #3184

Closed
@TarantoolBot

Description

@TarantoolBot

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

Will be done in scope of #3202

Details

The content is moved to #3202

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 tarantool/tarantool@90f6446.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.112.11 release and the associated technical debtbehavior change[nature] Сhange in existing behaviorduplicateThis issue or pull request already existsreference[location] Tarantool manual, Reference partsql[location] SQL manual

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions