Skip to content

parser: unexpected unknown 1 in where clause error #45898

Closed
@qw4990

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Run the unit test below:

func TestUnknown1InWhereClause(t *testing.T) {
	store := testkit.CreateMockStore(t)
	tk := testkit.NewTestKit(t, store)
	tk.MustExec("use test")
	tk.MustExec("create table t(a varchar(32) NOT NULL primary key,b varchar(22) not null,key idx_a (a))")
	go func() {
		tkk := testkit.NewTestKit(t, store)
		tkk.MustExec(`use test`)
		for k := 0; k < 10000; k++ {
			tkk.ExecToErr("select * from xw.t1 where 1=1 a.  ")
		}
	}()
	for k := 0; k < 10000; k++ {
		tk.MustQuery(`select count(1) from t where a = 'Q13'`).Check(testkit.Rows("0"))
	}
}

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

No error.

3. What did you see instead (Required)

                Error:          Received unexpected error:
                                [planner:1054]Unknown column '1' in 'where clause'

4. What is your TiDB version? (Required)

Metadata

Assignees

Labels

affects-5.4This bug affects the 5.4.x(LTS) versions.affects-6.1This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.component/parserpriority/release-blockerThis issue blocks a release. Please solve it ASAP.severity/moderatesig/sql-infraSIG: SQL Infratype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions