-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Currenlty, if we input a null value to to_char, we will get an empty string instead of a null value.
> select to_char(NULL, '%Y-%m-%d %H:%M:%S') is null;
+-------------------------------------------------+
| to_char(NULL,Utf8("%Y-%m-%d %H:%M:%S")) IS NULL |
+-------------------------------------------------+
| false |
+-------------------------------------------------+
1 row(s) fetched.
Elapsed 0.001 seconds.
> select to_char(NULL, '%Y-%m-%d %H:%M:%S');
+-----------------------------------------+
| to_char(NULL,Utf8("%Y-%m-%d %H:%M:%S")) |
+-----------------------------------------+
| |
+-----------------------------------------+
1 row(s) fetched.
Elapsed 0.001 seconds.
However, the postgres behavior is returing a null value if got a null input.
psql=# select to_char(null::timestamp, '%Y-%m-%d %H:%M:%S') is null;
?column?
----------
t
(1 row)
psql=# select to_char(null::timestamp, '%Y-%m-%d %H:%M:%S');
to_char
---------
(1 row)
I think we should follow the behavior of postgres.
To Reproduce
Execute the SQL mentioned above.
Expected behavior
to_char should return a null if got a null input.
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working