pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
37.03k stars 5.82k forks source link

When the decimal part of the decimal type is 0, a query exception will occur #56530

Open apollodafoni opened 4 hours ago

apollodafoni commented 4 hours ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `PK_MULTI_COL_5048` (
  `COL1` binary(10) NOT NULL,
  `COL2` binary(10) NOT NULL,
  `COL3` decimal(55,0) NOT NULL,
  PRIMARY KEY (`COL1`(5),`COL2`,`COL3`) /*T![clustered_index] CLUSTERED */,
  UNIQUE KEY `UIDXM` (`COL1`(5),`COL2`),
  UNIQUE KEY `UIDX` (`COL2`),
  KEY `IDX3` (`COL3`),
  KEY `IDXM` (`COL3`,`COL2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin

Query COL3 for decimal points but no decimals:

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

both query success

3. What did you see instead (Required)

it will not be recognized when only a decimal point and combined with other statements.

4. What is your TiDB version? (Required)

Release Version: v8.4.0-alpha-359-g2864508e3c Edition: Community Git Commit Hash: 2864508e3c89a380b0bf29b4ae3e66a8890efd30 Git Branch: HEAD UTC Build Time: 2024-10-10 04:16:33 GoVersion: go1.23.2 Race Enabled: false Check Table Before Drop: false Store: tikv

apollodafoni commented 4 hours ago

/severity moderate /component sql

ti-chi-bot[bot] commented 4 hours ago

@apollodafoni: The label(s) component/sql cannot be applied, because the repository doesn't have them.

In response to [this](https://github.com/pingcap/tidb/issues/56530#issuecomment-2404255648): >/severity moderate >/component sql Instructions for interacting with me using PR comments are available [here](https://prow.tidb.net/command-help). If you have questions or suggestions related to my behavior, please file an issue against the [ti-community-infra/tichi](https://github.com/ti-community-infra/tichi/issues/new?title=Prow%20issue:) repository.
apollodafoni commented 4 hours ago

/component parser