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

panic when union a view and temporary table #42563

Closed
lcwangchao opened this issue Mar 24, 2023 · 1 comment · Fixed by #42566
Closed

panic when union a view and temporary table #42563

lcwangchao opened this issue Mar 24, 2023 · 1 comment · Fixed by #42566

Comments

@lcwangchao
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t1(a int);
insert into t1 values(1);
create view tv as select * from t1;
create temporary table t1(a int);
select * from t1 union all select * from tv;

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

no error

3. What did you see instead (Required)

TiDB root@127.0.0.1:test> select * from t1 union all select * from tv;
(1105, 'runtime error: invalid memory address or nil pointer dereference')

4. What is your TiDB version? (Required)

+--------------------------------+
| tidb_version()                 |
+--------------------------------+
| Release Version: None          |
| Edition: Community             |
| Git Commit Hash: None          |
| Git Branch: None               |
| UTC Build Time: None           |
| GoVersion: go1.20.2            |
| Race Enabled: false            |
| TiKV Min Version: 6.2.0-alpha  |
| Check Table Before Drop: false |
| Store: unistore                |
+--------------------------------+
@lcwangchao lcwangchao added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra severity/major labels Mar 24, 2023
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels Mar 24, 2023
@lcwangchao lcwangchao added affects-6.6 affects-7.0 affects-6.3 affects-6.4 affects-6.5 and removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-6.1 may-affects-6.5 labels Mar 24, 2023
@lcwangchao
Copy link
Collaborator Author

It is introduced by #37393 , see:

func DetachLocalTemporaryTableInfoSchema(is infoschema.InfoSchema) infoschema.InfoSchema {
if attachedInfoSchema, ok := is.(*infoschema.SessionExtendedInfoSchema); ok {
newIs := attachedInfoSchema
newIs.LocalTemporaryTables = nil
return newIs
}

The infoschema's LocalTemporaryTables is removed and later the temporary table cannot be found in this inforschema .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants