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

Can't find column using case when function with union. #26662

Closed
wshwsh12 opened this issue Jul 27, 2021 · 1 comment · Fixed by #26663
Closed

Can't find column using case when function with union. #26662

wshwsh12 opened this issue Jul 27, 2021 · 1 comment · Fixed by #26663
Assignees
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@wshwsh12
Copy link
Contributor

wshwsh12 commented Jul 27, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Need open newcollation

use test;
create table t1(a varchar(36) NOT NULL) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci;

set names utf8;  #  utf8mb4 will also get error. But binary is ok.
desc select
    t2.b from
    (
        select t1.a as b
        from t1
        union all
        select t1.a as b
        from t1
    ) t2
where
    case
        when (t2.b is not null) then t2.b
        else ''
    end > '1234567';

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

query successfully.

3. What did you see instead (Required)

ERROR 1105 (HY000): Can't find column Column#5 in schema Column: [test.t1.a] Unique key: []

4. What is your TiDB version? (Required)

v4.0.12, master

@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.

4 participants