Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
YangKeao opened this issue Apr 18, 2024 · 0 comments · Fixed by #52720
Closed

Comments

@YangKeao
Copy link
Member

YangKeao commented Apr 18, 2024

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

@YangKeao YangKeao added the type/bug The issue is confirmed as a bug. label Apr 18, 2024
@YangKeao YangKeao self-assigned this Apr 18, 2024
@YangKeao YangKeao added the sig/sql-infra SIG: SQL Infra label Apr 18, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 25, 2024
ti-chi-bot bot pushed a commit that referenced this issue May 16, 2024
ti-chi-bot bot pushed a commit that referenced this issue May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant