pingcap / pingcap/tidb

Failed to create table with expression defaults `2 * pi()`

Open
#52,351 3 comments 0 reactions 0 assignees View on GitHub
type/feature-request
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step (Required)

```
mysql> create table t (a double default (2 * pi()));
```

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

Create table successfully.

### 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 1 column 35 near "2 * pi()))"
```

### 4. What is your TiDB version? (Required)

```
Release Version: v7.5.1
Edition: Community
Git Commit Hash: 7d16cc79e81bbf573124df3fd9351c26963f3e70
Git Branch: heads/refs/tags/v7.5.1
UTC Build Time: 2024-02-27 14:21:44
GoVersion: go1.21.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv
```

From Django 5.0 [release notes](https://docs.djangoproject.com/en/5.0/releases/5.0/#database-computed-default-values).

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reproducing CREATE TABLE t (a double default (2 * pi())); on TiDB v7.5.1 and trace the handling of expression defaults; done means the statement creates the table successfully without a syntax error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, mysql, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.