pingcap / pingcap/tidb

Unexpected error `%s value is out of range in '%s'`

Open
#63,899 0 comments 0 reactions 0 assignees View on GitHub
contribution severity/major sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

Hi, the following test contains two equivalent queries, but the prepared statement triggers an unexpected error:

```
SELECT CEILING((- (-9223372036854775808))); -- 9223372036854775808
SET @a = -9223372036854775808;
PREPARE prepare_query FROM 'SELECT CEILING((- (?)))';
EXECUTE prepare_query USING @a; -- %s value is out of range in '%s'
DEALLOCATE PREPARE prepare_query;
```

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

No error.

### 3. What did you see instead (Required)

`%s value is out of range in '%s'`

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

Release Version: v9.0.0-beta.2.pre-551-g71caddf56d\nEdition: Community\nGit Commit Hash: 71caddf56d9c1887650568101590417558149e3f\nGit Branch: master\nUTC Build Time: 2025-09-24 10:56:45\nGoVersion: go1.23.12\nRace Enabled: false\nCheck Table Before Drop: false\nStore: unistore\nKernel Type: Classic

Contributor guide

Open the contributing guide

Research direction

The report provides no source file or test entry point. Reproduce the direct and prepared CEILING queries using the shown PREPARE/EXECUTE sequence, then trace prepared-statement parameter handling; done means the prepared form matches the direct query without a range error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.