Skip to content

Incorrect result onselect syntax when column and alias having the same name #401

@FlyingMao

Description

@FlyingMao

steps:

mysql> select * from test_shard;
+----+----+------------+-----+
| id | k  | c          | pad |
+----+----+------------+-----+
|  0 |  0 | 0          |   0 |
|  4 |  4 | id4        |   4 |
|  8 |  8 | $id8$      |   4 |
| 12 | 12 | _g         |   5 |
| 16 | 16 | 16         |  -1 |
|  2 |  2 | id2        |   2 |
|  6 |  6 | id6        |   2 |
| 10 | 10 | 中         |   3 |
| 14 | 14 | 20%        |  14 |
| 18 | 18 | a          |  18 |
|  1 |  1 | id1        |   1 |
|  5 |  5 | id5        |   1 |
|  9 |  9 | test       |   3 |
| 13 | 13 | y_u        |   6 |
| 17 | 17 | new*
*line |  17 |
|  3 |  3 | id3        |   1 |
|  7 |  7 | id7        |   3 |
| 11 | 11 | i_         |   4 |
| 15 | 15 | a_1        |  15 |
+----+----+------------+-----+
19 rows in set (0.01 sec)

mysql> select c as c from test_shard;
+-------+
| c     |
+-------+
| 0     |
| id4   |
| $id8$ |
| _g    |
| 16    |
+-------+
5 rows in set (0.01 sec)

explain result:

mysql> explain select c as c from test_shard;
+-----------+----------+-------------------------------+
| DATA_NODE | TYPE     | SQL/REF                       |
+-----------+----------+-------------------------------+
| dn1       | BASE SQL | select c as c from test_shard |
+-----------+----------+-------------------------------+
1 row in set (0.01 sec)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions