Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

NULL is not printed in the resulting table #779

Closed
@zwcn

Description

@zwcn

Hi,

When I used mysql client to connect the SQL server, I got the following table in which there were some empty fields that were supposed to be printed as NULL.

What I got:

$ mysql -h 127.0.0.1 -u root
mysql> select * from tbl where timestamp = 3;
+--------------+-----------+-----------+-------------+
| id           | timestamp | col1      | col2       |
+--------------+-----------+-----------+-------------+
| id1          |         3 |           |           3 |
| id2          |         3 |           |           3 |
| id3          |         3 |         3 |             |
+--------------+-----------+-----------+-------------+
3 rows in set (0.51 sec)

What I expect:

$ mysql -h 127.0.0.1 -u root
mysql> select * from tbl where timestamp = 3;
+--------------+-----------+-----------+-------------+
| id           | timestamp | col1      | col2        |
+--------------+-----------+-----------+-------------+
| id1          |         3 |   NULL    |           3 |
| id2          |         3 |    NULL   |           3 |
| id3          |         3 |         3 |    NULL     |
+--------------+-----------+-----------+-------------+
3 rows in set (0.51 sec)

It seems to me that in https://github.com/src-d/go-mysql-server/pull/753/files#diff-654bac6a55597b15c4a5d404095b4e69R306, shouldn't we handle both nil and nullT? For example:

if _, ok := v.(nullT); ok || v == nil {
  return sqltypes.NULL, nil
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions