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

ErrBadField occurs when using Function DEFAULT with ORDER BY clause #11210

Closed
SunRunAway opened this issue Jul 11, 2019 · 8 comments
Closed

ErrBadField occurs when using Function DEFAULT with ORDER BY clause #11210

SunRunAway opened this issue Jul 11, 2019 · 8 comments
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@SunRunAway
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
CREATE TABLE `test1` (
  `a` decimal(10,4) unsigned DEFAULT NULL,
  `b` float DEFAULT NULL
);
INSERT INTO `test1` VALUES (1.0090,-1),(1.0090,-1);
  1. What did you expect to see?
mysql> SELECT a FROM test1 ORDER BY DEFAULT(b);
+--------+
| a      |
+--------+
| 1.0090 |
| 1.0090 |
+--------+
2 rows in set (0.00 sec)
  1. What did you see instead?
mysql> SELECT a FROM test1 ORDER BY DEFAULT(b);
ERROR 1054 (42S22): Unknown column 'b' in 'order clause'
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    0ea1bf0
@SunRunAway SunRunAway added type/bug The issue is confirmed as a bug. component/expression and removed component/expression labels Jul 11, 2019
@SunRunAway SunRunAway added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jul 12, 2019
@gaoxingliang
Copy link
Contributor

I will check this issue.

@gaoxingliang
Copy link
Contributor

note if the cols exists in the select, it's okay (seems column pruned before checking sort by)

SELECT a, b FROM test1 ORDER BY DEFAULT(b);

@ti-challenge-bot
Copy link

It is not a pickable issue!

@time-and-fate
Copy link
Member

This bug has been fixed by #19709 on master but not cherry-picked to release-4.0

@ichn-hu
Copy link
Contributor

ichn-hu commented Nov 26, 2020

@rebelice PTAL

@rebelice
Copy link
Contributor

I'll cherry-pick this pr later.

@wjhuang2016
Copy link
Member

Close this issue because the bug had been fixed by #19709.

@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
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants