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 error when use DEFAULT() with subquery #13390

Closed
Deardrops opened this issue Nov 12, 2019 · 0 comments
Closed

unexpected error when use DEFAULT() with subquery #13390

Deardrops opened this issue Nov 12, 2019 · 0 comments
Labels
type/bug The issue is confirmed as a bug.

Comments

@Deardrops
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 t2(f1 int(11) default 11);
insert into t2 value ();
select default(f1) from (select * from t2) t1;
select default(f1) from (select * from (select * from t2) t1 ) t1;
  1. What did you expect to see?
mysql> select default(f1) from (select * from t2) t1;
+-------------+
| default(f1) |
+-------------+
|          11 |
+-------------+
1 row in set (0.00 sec)

mysql> select default(f1) from (select * from (select * from t2) t1 ) t1;
+-------------+
| default(f1) |
+-------------+
|          11 |
+-------------+
1 row in set (0.00 sec)
  1. What did you see instead?
mysql> select default(f1) from (select * from t2) t1;
+-------------+
| default(f1) |
+-------------+
|          11 |
+-------------+
1 row in set (0.00 sec)

mysql> select default(f1) from (select * from (select * from t2) t1 ) t1;
ERROR 1054 (42S22): Unknown column 'f1' in 'field_list'
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
Release Version: v4.0.0-alpha-737-g538077ff7
Git Commit Hash: 538077ff759098fc2cc22bb7892698d3e60e9010
Git Branch: update-default
UTC Build Time: 2019-11-06 07:24:52
GoVersion: go version go1.13.1 linux/amd64
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@Deardrops Deardrops added the type/bug The issue is confirmed as a bug. label Nov 12, 2019
Deardrops added a commit to Deardrops/tidb that referenced this issue Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant