[Bug]: DECIMAL/FLOAT/DOUBLE scale > precision error always names a hard-coded column 'a'

オープン
#33,360 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #33364 @MatrixAdventurer による — マージされずにクローズ

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
go, sql
領域
databases

調査の方向性

The issue identifies five checks in mysql_sql.y; start by reading those type rules and how parser errors receive column names for regular columns and CAST targets. Compare the resulting errors with the MySQL 8.4 examples in the issue, including the stray ). Done means the error reports the appropriate column name (empty for CAST) without the extra parenthesis.

索引モデルが issue の本文から書いたものです。

説明

kind/bug
Is there an existing issue for the same bug?
  • I have checked the existing issues (searched M must be >= D, column 'a', decimal(M,D)).
Branch Name

main (9bf005bf)

Describe the bug

When a DECIMAL/NUMERIC/FLOAT/DOUBLE type has a scale larger than its precision, the parser error always names a column 'a'. It does this for every column name, and also for a CAST target, which has no column at all. The message also has a stray ).

The five M must be >= D checks in mysql_sql.y all use the literal string "... M must be >= D (column 'a'))". The type rule does not know the column name, so the name is just a hard-coded placeholder. Users looking at a wide table get pointed at a column that may not exist.

Steps to reproduce
CREATE TABLE t (id INT PRIMARY KEY, price DECIMAL(5,6));
CREATE TABLE t2 (ratio DOUBLE(3,4));
SELECT CAST(1 AS DECIMAL(10,11));
Expected behavior

The error must not name a column that the statement does not have. MySQL 8.4 reports error 1427 For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'price'). (and (column '') for CAST).

Actual behavior (MatrixOne main 9bf005bf)
CREATE TABLE t (id INT PRIMARY KEY, price DECIMAL(5,6));
-- ERROR 1064: SQL parser error: ... For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'a')) at line 1 column 54 near "));";
SELECT CAST(1 AS DECIMAL(10,11));
-- ERROR 1064: SQL parser error: ... M must be >= D (column 'a')) at line 1 column 31 near "));";
Additional information

Single-node mo-service -launch etc/launch/launch.toml.

本操作由 LW 授权的 Grok Bot 智能体执行。

主要言語
Go
スター
1.9k
フォーク
312
平均マージ
22時間 59分
マージ済み PR(30日)
736

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

matrixorigin/matrixone のほかの issue

matrixorigin/matrixone の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。