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

plan cache would be broken if empty range DataSource is converted to TableDual #7579

Closed
eurekaka opened this issue Sep 2, 2018 · 0 comments · Fixed by #7808
Closed

plan cache would be broken if empty range DataSource is converted to TableDual #7579

eurekaka opened this issue Sep 2, 2018 · 0 comments · Fixed by #7808
Labels
sig/planner SIG: Planner

Comments

@eurekaka
Copy link
Contributor

eurekaka commented Sep 2, 2018

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.

set prepared-plan-cache-enabled=true first in config.toml and start TiDB using this config file.

MySQL [test]> create table t(a int, b int, index a_idx(a));
Query OK, 0 rows affected (0.01 sec)

MySQL [test]> insert into t values(1,1),(2,2),(null,3);
Query OK, 3 rows affected (0.00 sec)

MySQL [test]> select * from t;
+------+------+
| a    | b    |
+------+------+
|    1 |    1 |
|    2 |    2 |
| NULL |    3 |
+------+------+
3 rows in set (0.00 sec)

MySQL [test]> prepare stmt from 'select * from t where ?';
Query OK, 0 rows affected (0.00 sec)

MySQL [test]> execute stmt using @param;
Empty set (0.00 sec)

MySQL [test]> set @param = true;
Query OK, 0 rows affected (0.00 sec)

MySQL [test]> execute stmt using @param;
Empty set (0.00 sec)
  1. What did you expect to see?

last execute statement should return all 3 rows of table.

  1. What did you see instead?

empty set returned.

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
MySQL [test]> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                                    |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v2.1.0-rc.1-18-geec6899
Git Commit Hash: eec68995689d5811f4d52846586e969652ed8ffc
Git Branch: master
UTC Build Time: 2018-09-01 06:53:29
GoVersion: go version go1.11rc1 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner
Projects
None yet
1 participant