A Question on TiDB Syntax Compatibility

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

Original topic: tidb 语法兼容性一问

| username: ShawnYan

To improve efficiency, please provide the following information. Clear problem descriptions can be resolved faster:

【TiDB Usage Environment】Production, Testing, Research
【TiDB Version】tidb v6.1
【Encountered Problem】tidb syntax not supported
【Reproduction Path】What operations were performed that caused the problem

(root@127.1) [test] 11:49:56> CREATE TABLE word
    -> (
    ->     id        INT PRIMARY KEY AUTO_INCREMENT,
    ->     text      VARCHAR(64),
    ->     topic_id  INT NOT NULL REFERENCES topic (id),
    ->     published DATE,
    ->     length    INT NOT NULL DEFAULT LENGTH(text),
    ->     UNIQUE KEY word_topic_text (topic_id, text),
    ->     UNIQUE KEY word_topic_published_length_uk (topic_id, published, length)
    -> ) ;
ERROR 3770 (HY000): Default value expression of column 'length' contains a disallowed function: `LENGTH`.
(root@127.1) [test] 11:50:01>

【Problem Phenomenon and Impact】

In MariaDB, the syntax DEFAULT LENGTH(text), is supported.

【Attachments】

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: cheng | Original post link

MySQL Compatibility Reference Document Comparison with MySQL Compatibility | PingCAP Docs

| username: ShawnYan | Original post link

This situation is not documented.

| username: ShawnYan | Original post link

Compatibility issues, currently not supported.
The documentation also does not clearly specify which expressions are supported.

Currently supported expressions:

getFuncCallDefaultValue

| username: system | Original post link

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