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

insert into partition table when data meet no partition,show warnings should output the error message #22096

Closed
goxuetang opened this issue Dec 30, 2020 · 5 comments
Labels
severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@goxuetang
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (id int) partition by list (id) (partition p0 values in (3,5,6,9,17));
insert into t_21966 values(100);
show warnings;

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

show warnings should output:
+-------+------+--------------------------------------+
| Level | Code | Message |
+-------+------+--------------------------------------+
| Error | 1526 | Table has no partition for value 100 |
+-------+------+--------------------------------------+

3. What did you see instead (Required)

show warnings; Empty set (0.01 sec)

4. What is your TiDB version? (Required)

select tidb_version();

Release Version: None
Edition: Community
Git Commit Hash: None
Git Branch: None
UTC Build Time: None
GoVersion: go1.14.9
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

@goxuetang goxuetang added the type/bug The issue is confirmed as a bug. label Dec 30, 2020
@goxuetang
Copy link
Contributor Author

when i fixed load data meet no partition, I found this bug

@xiongjiwei
Copy link
Contributor

xiongjiwei commented Dec 30, 2020

well, actually all the errors in MySQL will appear when show warnings even syntax error, but tidb does not.

@wshwsh12
Copy link
Contributor

See https://docs.pingcap.com/tidb/dev/partitioned-table#list-partitioning
We should set @@session.tidb_enable_table_partition = nightly firstly.

[tidb]> set @@session.tidb_enable_table_partition = nightly;
Query OK, 0 rows affected (0.000 sec)

[tidb]> create table t (id int) partition by list (id) (partition p0 values in (3,5,6,9,17));
Query OK, 0 rows affected (0.005 sec)

[tidb]> insert into t values(100);
ERROR 1526 (HY000): Table has no partition for value 100
[tidb]> show warnings;
Empty set (0.000 sec)

Show warnings doesn't print the error message again...

@XuHuaiyu XuHuaiyu added sig/planner SIG: Planner and removed sig/execution SIG execution labels Feb 18, 2021
@mjonss
Copy link
Contributor

mjonss commented May 28, 2021

well, actually all the errors in MySQL will appear when show warnings even syntax error, but tidb does not.

Example:

mysql> a;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a' at line 1
mysql> show warnings;
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message                                                                                                                                             |
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
| Error | 1064 | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a' at line 1 |
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0,00 sec)

mysql> select version();
+-------------------------+
| version()               |
+-------------------------+
| 8.0.25-0ubuntu0.21.04.1 |
+-------------------------+
1 row in set (0,00 sec)

^ MySQL 8.0.25
v TiDB master

tidb> a;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 1 near "a" 
tidb> show warnings;
Empty set (0.00 sec)

tidb> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v5.1.0-alpha-46-gf891c5a7c-dirty
Edition: Community
Git Commit Hash: f891c5a7cbbb2082ed281e1c63e3abb1890cea1c
Git Branch: master
UTC Build Time: 2021-05-27 19:29:34
GoVersion: go1.16.3
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)

So I don't think this should be a part of the partitioning project?

@Defined2014
Copy link
Contributor

It's fixed in master branch right now, so close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

8 participants