Skip to content

Date parameters are converted to string automatically #45190

Closed
@YangKeao

Description

TiDB handles the date parameters as string, which is not expected. TiDB should construct a data, but not string for these parameters. See:

		case mysql.TypeDate, mysql.TypeTimestamp, mysql.TypeDatetime:
			if len(paramValues) < (pos + 1) {
				err = mysql.ErrMalformPacket
				return
			}
			// See https://dev.mysql.com/doc/internals/en/binary-protocol-value.html
			// for more details.
			length := paramValues[pos]
			pos++
			switch length {
			case 0:
				tmp = types.ZeroDatetimeStr
			case 4:
				pos, tmp = binaryDate(pos, paramValues)
			case 7:
				pos, tmp = binaryDateTime(pos, paramValues)
			case 11:
				pos, tmp = binaryTimestamp(pos, paramValues)
			case 13:
				pos, tmp = binaryTimestampWithTZ(pos, paramValues)
			default:
				err = mysql.ErrMalformPacket
				return
			}
			args[i] = types.NewDatum(tmp) // FIXME: After check works!!!!!!
			continue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions