CREATE TABLE statement with RANGE INTERVAL reports syntax error

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: Range INTERVAL 建表语句报语法错误

| username: TiDBer_9DI8NTyk

Could someone please help me understand why using the interval syntax to create a range partitioned table results in an error?

Creating the table in the usual way works, but using the interval method results in the following error:
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 9 near “”

| username: TiDBer_小阿飞 | Original post link

You didn’t add a space in “INTERVAL (10) FIRST PARTITION,” right?

| username: 数据库真NB | Original post link

Make it clear, the INTERVAL (10) FIRST in line 8 is all marked in red, not separated, and cannot be recognized.

| username: TiDBer_9DI8NTyk | Original post link

Spaces don’t seem to affect it, the result is the same when executed again.

| username: Daniel-W | Original post link

Partitioned Table | PingCAP Documentation Center

| username: TiDBer_9DI8NTyk | Original post link

The execution results are the same after separating.

| username: redgame | Original post link

Apply it.

| username: TiDBer_9DI8NTyk | Original post link

The same error also occurred.

| username: DBAER | Original post link

Is it because the version is not compatible and requires v6.3.0?

| username: Demo二棉裤 | Original post link

What is the TiDB version?

| username: zhaokede | Original post link

Which version of TiDB are you using?

| username: TiDBer_小阿飞 | Original post link

To use the INTERVAL syntax for RANGE COLUMNS partitioning, you can only specify one column as the partition key, and the type of that column must be an integer (INTEGER), date (DATE), or datetime (DATETIME).

| username: TiDBer_9DI8NTyk | Original post link

7.1.1

| username: TiDBer_9DI8NTyk | Original post link

Version 7.1.1

| username: TiDBer_9DI8NTyk | Original post link

This is just a simple range partition. Creating a table using the normal form works fine, but using the interval form results in an error.

| username: forever | Original post link

Did you directly copy his? Does it report an error?

| username: tidb菜鸟一只 | Original post link

No problem

| username: 小于同学 | Original post link

Didn’t add a space, right?

| username: TiDBer_9DI8NTyk | Original post link

Thank you, master. The command line execution is indeed fine, but there is an error in DataGrip. It’s very strange.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.