Skip to content

[Compatibility]: SHOW COUNT(*) diagnostics and @@warning_count/@@error_count are unsupported #28682

Closed

Description

@Ariznawlll

Description

MatrixOne supports SHOW WARNINGS and SHOW ERRORS, but rejects MySQL's corresponding diagnostic-count statements and system variables:

SHOW COUNT(*) WARNINGS;
SHOW COUNT(*) ERRORS;
SELECT @@warning_count;
SELECT @@error_count;

This prevents MySQL-compatible clients from reading the number of diagnostics without fetching the complete diagnostic list.

Environment

  • Branch: main
  • Commit: 065a67528608c475d0219e0be6b7d454a58f7b1a
  • Deployment: local 2 CN / 1 TN / 1 LogService
  • Oracle: MySQL 8.3.0 isolated local instance

Steps to reproduce

create database diag_count_compat;
use diag_count_compat;
create table t(id int primary key,v varchar(10));
insert into t values (1,'aaaa'),(2,'bbbb');
set session group_concat_max_len=5;

select group_concat(v order by id separator '|') from t;
show count(*) warnings;

select group_concat(v order by id separator '|') from t;
select @@warning_count;

select missing_column from t;
show count(*) errors;

select missing_column from t;
select @@error_count;

Actual behavior

The two SHOW COUNT(*) statements are rejected by the parser with error 1064 at COUNT(*). The two system variables are rejected with error 20101, the system variable does not exist.

SHOW WARNINGS remains a passing control and exposes the expected 1260 record, so the session has a diagnostic that can be counted.

Expected behavior

As in MySQL 8.3.0:

  • SHOW COUNT(*) WARNINGS exposes @@session.warning_count;
  • SHOW COUNT(*) ERRORS exposes @@session.error_count;
  • @@warning_count and @@error_count expose the same counts through expressions.

The reproducer returns 1 for each count in MySQL.

Stability and controls

  • MatrixOne reproducer: 3/3 for all four missing interfaces.
  • MySQL 8.3.0 oracle: 3/3; warning and error counts are both 1 immediately after the generating statement.
  • MatrixOne control: SHOW WARNINGS returns Warning 1260 Row 2 was cut by GROUP_CONCAT().
  • No data mutation is involved.

Code analysis

The MySQL parser grammar currently accepts only SHOW WARNINGS limit_opt and the tree.ShowWarnings/tree.ShowErrors nodes have no count form. pkg/frontend/variables.go registers max_error_count, but does not register read-only warning_count or error_count session status variables.

Regression coverage

After implementation, cover all four forms after zero, one, and multiple warnings/errors, including statement reset semantics and LIMIT on the ordinary SHOW WARNINGS/SHOW ERRORS forms.

Activity

  1. added this to the MO-202609 milestone on Sep 11, 2026
  2. added theissue type on Sep 11, 2026
  3. Ariznawlll commented on Sep 11, 2026

    @Ariznawlll
    CollaboratorAuthor

    在更新后的 official main ee0c2bf563bf27ff2c80891bb57a1de5886bf90b(本地 2 CN / 1 TN / 1 LogService)复核 3 轮,四个缺失接口每轮表现一致:

    • SHOW COUNT(*) WARNINGS:parser error 1064;
    • SHOW COUNT(*) ERRORS:parser error 1064;
    • @@warning_count:system variable does not exist;
    • @@error_count:system variable does not exist。

    普通 SHOW WARNINGS 仍能返回刚生成的 1260 诊断,说明诊断本身存在,仅计数语法和计数变量缺失。

  4. self-assigned this
    on Sep 11, 2026
  5. added a commit that references this issue on Sep 12, 2026
    931ae21
  6. Ariznawlll commented on Sep 14, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main
    • commit:07b25969bfea9d4b76d3bf05d5b0497e4f36eba0
    • 部署:本地独立 1 CN / 1 TN / 1 LogService;每轮均重新启动服务后执行。
    • 执行:每项 SQL 回归连续 3 轮,输出逐轮一致。

    原问题验证

    • SHOW COUNT(*) ERRORS、@@warning_count、@@error_count diagnostics 已可用。

    Happy Path 覆盖

    • 覆盖合法语句后的 diagnostics 查询与会话继续执行。

    Unhappy Path 覆盖

    • 访问不存在列后返回预期错误,SHOW COUNT(*) ERRORS=1 且 @@error_count=1。

    白盒验证

    • 以 MOTR 固定 diagnostics 输出与错误恢复路径。

    回归测试

    测试证据

    • 以上结果均在该 main commit 的独立环境获得;每轮无 stderr,三轮结果一致。

    测试结论

    测试通过。

  7. added 3 commits that reference this issue on Sep 17, 2026
    d1f8bb5
    b430acd
    62b831f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/compatibilitykind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions