Skip to content

Executing many-values or multi-row insert statements with NULL values fails #209

@ffdwg

Description

@ffdwg

Inserting rows with more than 32 values fails if there are NULL values beyond this limit.

You can reproduce the error using a very wide table (>32 fields) and insert a NULL row or similar:

INSERT INTO mytab (x1, x2, x3, ..., x32, x33)
VALUES (?, ?, ?, ..., ?, ?)

Execute it with parameters like:

[ 1, 2, 3, ... , 32, nil ]

The same happens on small tables with a multi-row insert

INSERT INTO mytab VALUES (?, ?, ?), (?, ?, ?), ... (?, ?, ?)

with more than 32 values and latter NULL/nil values.
The SQL server answers with

Error 1210: Incorrect arguments to mysqld_stmt_execute

I assume that there is a bug in packets.go stmt.writeExecutePacket function: The nullMask variable should be an array of byte or uint to support more than 32 fields (bits), right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions