[Tarantool-patches] [PATCH v3 1/2] sql: use unify pattern for column names

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Wed Jul 1 00:23:18 MSK 2020


Hi! Thanks for the fixes!

> +test:do_execsql2_test(
> +    "colname-12.5",
> +    [[
> +        CREATE TABLE j (s1 SCALAR PRIMARY KEY);
> +        INSERT INTO j VALUES(1);
> +    ]], {})
> +
> +--
> +-- Column named as 'COLUMN_1', because 's1 + 1' is a expression.
> +--
> +test:do_execsql2_test(
> +    "colname-12.6",
> +    [[
> +        SELECT s1 + 1 FROM j;
> +    ]], {
> +        "COLUMN_1",2
> +    })
> +
> +test:do_execsql2_test(
> +    "colname-12.7",
> +    [[
> +        SELECT s1 + 1 FROM j ORDER BY column_1;
> +    ]], {
> +        "COLUMN_1",2
> +    })
> +
> +test:do_execsql2_test(
> +    "colname-12.8",
> +    [[
> +        SELECT * FROM (SELECT s1 + 1 FROM j
> +                       ORDER BY column_1) ORDER BY column_1;
> +    ]], {
> +        "COLUMN_1",2
> +    })
> +
> +test:do_execsql2_test(
> +    "colname-12.9",
> +    [[
> +        SELECT s1 + 1 FROM j GROUP BY column_1;
> +    ]], {
> +        "COLUMN_1",2
> +    })
> +
> +test:do_execsql2_test(
> +    "colname-12.10",
> +    [[
> +        SELECT * FROM (SELECT s1 + 1 FROM j
> +                       ORDER BY column_1) GROUP BY column_1;
> +    ]], {
> +        "COLUMN_1",2
> +    })
> +
> +test:do_execsql2_test(
> +    "colname-12.11",
> +    [[
> +        SELECT * FROM (SELECT s1 + 1 FROM j
> +                       ORDER BY column_1) WHERE column_1 = 2;
> +    ]], {
> +        "COLUMN_1",2
> +    })
> +
> +test:do_execsql2_test(
> +    "colname-12.12",
> +    [[
> +        SELECT *, s1 + 1 FROM j ORDER BY column_1;
> +    ]], {
> +        "S1",1,"COLUMN_1",2
> +    })
> +
> +test:do_execsql2_test(
> +    "colname-12.13",
> +    [[
> +        SELECT s1 + 1, * FROM j ORDER BY column_1;
> +    ]], {
> +        "COLUMN_1",2,"S1",1
> +    })
> +
> +test:do_execsql2_test(
> +    "colname-12.14",
> +    [[
> +        CREATE TABLE j_1 (column_1 SCALAR PRIMARY KEY, column_2 SCALAR);
> +        INSERT INTO j_1 VALUES(1, 1);
> +    ]], {})
> +
> +test:do_execsql2_test(
> +    "colname-12.15",
> +    [[
> +        SELECT column_1, column_1 + 1, column_2, 2 FROM j_1;
> +    ]], {
> +        "COLUMN_1",1,"COLUMN_1",2,"COLUMN_2",1,"COLUMN_2",2
> +    })
> +

Is there a test on how ORDER BY selects a column?


More information about the Tarantool-patches mailing list