pingcap / pingcap/tidb

Prepared statement uses stale div_precision_increment value after session variable change

Open
#71,040 5 comments 0 reactions 0 assignees View on GitHub
affects-25.10 affects-26.3 affects-8.1 affects-8.5 contribution first-time-contributor severity/major sig/sql-infra 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)

```
PREPARE s FROM 'SELECT 1/3';
EXECUTE s;
SET SESSION div_precision_increment = 8;
EXECUTE s;
```

### 2. What did you expect to see? (Required)
After executing:
`SET SESSION div_precision_increment = 8;`
the prepared statement should use the updated session value when executed.
**Expected Result:** 0.33333333

### 3. What did you see instead (Required)
The prepared statement continues to use the previous value of div_precision_increment.
**Actual Result:** 0.3333

### 4. What is your TiDB version? (Required)
8.0.11-TiDB-v8.5.8

Contributor guide

Open the contributing guide

Research direction

Start by running the reported PREPARE, EXECUTE, and SET SESSION div_precision_increment sequence against TiDB, then trace prepared-statement handling of session variables. Add a regression test for this sequence and verify that the second execution returns 0.33333333 rather than 0.3333.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.