Skip to content

The type of the param sent through SEND_LONG_DATA is not set according to the request #52711

@YangKeao

Description

@YangKeao

Bug Report

1. Minimal reproduce step (Required)

Create the table

CREATE TABLE t (j JSON);

Prepare the following statement

INSERT INTO t (j) VALUES (cast(? as json))

Execute this statement with SEND_LONG_DATA and pass a string parameter . Usually, it can be triggered by using a too long parameter.

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

The json value is a normal string.

3. What did you see instead (Required)

The json value is a opaque blob value, which means the parameter is used as a blob value.

4. What is your TiDB version? (Required)

Nightly.

The wrong code:

	for i := 0; i < len(params); i++ {
		// if params had received via ComStmtSendLongData, use them directly.
		// ref https://dev.mysql.com/doc/internals/en/com-stmt-send-long-data.html
		// see clientConn#handleStmtSendLongData
		if boundParams[i] != nil {
			params[i] = param.BinaryParam{
				Tp:  mysql.TypeBlob,
				Val: enc.DecodeInput(boundParams[i]),
			}
			continue
		}

TiDB should get the type from paramTypes

Metadata

Metadata

Assignees

Labels

affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.severity/majorsig/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