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

order of placement rules on partitioned tables is too strict #28832

Closed
Tracked by #18030
morgo opened this issue Oct 14, 2021 · 2 comments
Closed
Tracked by #18030

order of placement rules on partitioned tables is too strict #28832

morgo opened this issue Oct 14, 2021 · 2 comments
Labels
sig/sql-infra SIG: SQL Infra

Comments

@morgo
Copy link
Contributor

morgo commented Oct 14, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

DROP TABLE IF EXISTS t1;
DROP PLACEMENT POLICY IF EXISTS companystandardpolicy;

CREATE PLACEMENT POLICY companystandardpolicy CONSTRAINTS="";

CREATE TABLE t1 (id INT, name VARCHAR(50), purchased DATE)
 PARTITION BY RANGE( YEAR(purchased) ) (
  PARTITION p0 VALUES LESS THAN (2000),
  PARTITION p1 VALUES LESS THAN (2005),
  PARTITION p2 VALUES LESS THAN (2010),
  PARTITION p3 VALUES LESS THAN (2015),
  PARTITION p4 VALUES LESS THAN MAXVALUE
 )  PLACEMENT POLICY=companystandardpolicy; -- fails
 
CREATE TABLE t1 (id INT, name VARCHAR(50), purchased DATE)
 PLACEMENT POLICY=companystandardpolicy
 PARTITION BY RANGE( YEAR(purchased) ) (
  PARTITION p0 VALUES LESS THAN (2000),
  PARTITION p1 VALUES LESS THAN (2005),
  PARTITION p2 VALUES LESS THAN (2010),
  PARTITION p3 VALUES LESS THAN (2015),
  PARTITION p4 VALUES LESS THAN MAXVALUE
 ); -- works

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

Both examples should work

3. What did you see instead (Required)

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 8 column 14 near "PLACEMENT POLICY=companystandardpolicy" 

4. What is your TiDB version? (Required)

mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v5.3.0-alpha-1102-gbd518d580
Edition: Community
Git Commit Hash: bd518d5806050e2d470d14c3fc8111d5a5e9b52e
Git Branch: HEAD
UTC Build Time: 2021-10-14 17:00:56
GoVersion: go1.16.7
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)
@morgo
Copy link
Contributor Author

morgo commented Oct 18, 2021

We discussed this today, and decided that it is 'not a bug'. Consider this case from MySQL 8.0.24:

CREATE TABLE t1 (id INT, name VARCHAR(50), purchased DATE)   PARTITION BY RANGE( YEAR(purchased) ) (   PARTITION p0 VALUES LESS THAN (2000),   PARTITION p1 VALUES LESS THAN (2005),   PARTITION p2 VALUES LESS THAN (2010),   PARTITION p3 VALUES LESS THAN (2015),   PARTITION p4 VALUES LESS THAN MAXVALUE  ) engine=innodb; -- error

CREATE TABLE t1 (id INT, name VARCHAR(50), purchased DATE)  engine=innodb PARTITION BY RANGE( YEAR(purchased) ) (   PARTITION p0 VALUES LESS THAN (2000),   PARTITION p1 VALUES LESS THAN (2005),   PARTITION p2 VALUES LESS THAN (2010),   PARTITION p3 VALUES LESS THAN (2015),   PARTITION p4 VALUES LESS THAN MAXVALUE  ) ; -- valid

@morgo morgo closed this as completed Oct 18, 2021
@morgo morgo removed the type/bug The issue is confirmed as a bug. label Oct 18, 2021
@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra
Projects
None yet
Development

No branches or pull requests

2 participants