pingcap / pingcap/tidb

Get "Can't find column" error using execute statement

Open
#58,761 0 comments 0 reactions 1 assignee Claimed by @qw4990 View on GitHub
epic/plan-cache severity/moderate 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)

```sql
CREATE TABLE t1 (col1 int, col2 int);

prepare p3 from "select avg(col1) from t1 where not( col1 < ? ) or ( col2 = ? ) group by col1 having col1 = 7";

set @i0 = 1, @i1 = 1;

execute p3 using @i0, @i1;
```

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

Success.

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

```sql
mysql> execute p3 using @i0, @i1;execute p3 using @i0, @i1;
ERROR 1105 (HY000): Can't find column test.t1.col2 in schema Column: [test.t1.col1] PKOrUK: [] NullableUK: []
```

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

master

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.