Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected result of union #26532

Closed
XuHuaiyu opened this issue Jul 25, 2021 · 3 comments · Fixed by #26533
Closed

unexpected result of union #26532

XuHuaiyu opened this issue Jul 25, 2021 · 3 comments · Fixed by #26533
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@XuHuaiyu
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

select greatest(cast("2020-01-01 01:01:01" as datetime), cast("2019-01-01 01:01:01" as datetime) )union select null;

2. What did you expect to see? (Required)

mysql> select greatest(cast("2020-01-01 01:01:01" as datetime), cast("2019-01-01 01:01:01" as datetime) )union select null;

+---------------------------------------------------------------------------------------------+
| greatest(cast("2020-01-01 01:01:01" as datetime), cast("2019-01-01 01:01:01" as datetime) ) |
+---------------------------------------------------------------------------------------------+
| 2020-01-01 01:01:01                                                                         |
| NULL                                                                                        |
+---------------------------------------------------------------------------------------------+
2 rows in set (0.01 sec)

3. What did you see instead (Required)

tidb> select greatest(cast("2020-01-01 01:01:01" as datetime), cast("2019-01-01 01:01:01" as datetime) )union select null;

+---------------------------------------------------------------------------------------------+
| greatest(cast("2020-01-01 01:01:01" as datetime), cast("2019-01-01 01:01:01" as datetime) ) |
+---------------------------------------------------------------------------------------------+
| NULL                                                                                        |
|                                                                                             |
+---------------------------------------------------------------------------------------------+
2 rows in set, 1 warning (0.01 sec)

4. What is your TiDB version? (Required)

a414603

@XuHuaiyu XuHuaiyu added the type/bug The issue is confirmed as a bug. label Jul 25, 2021
@XuHuaiyu
Copy link
Contributor Author

This bug is introduced by #21150

@aytrack
Copy link
Contributor

aytrack commented Jul 26, 2021

this issue can also reproduce in 5.1.0, 4.0.13, 5.0.3

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants