Skip to content

Ensure max packet size is respected  #7

Closed as duplicate
Closed as duplicate

Description

@shuhaowu

Originally by @pushrax:

The Go library will return an error (ErrPktTooLarge) if a packet is written that exceeds what it thinks is the max packet size.

By default that's 4 MiB. The default values are set in NewConfig(). However, we're not calling NewConfig(), we're building the config object ourselves. This means that in this code MaxAllowedPacket is 0, and it loads the limit from the server. I tested this locally and it indeed is always loading the limit from the server. Thus, at the moment, exceeding the real max packet size will always return a nice Go error.

Activity

  1. driv3r commented on Oct 14, 2026

    @driv3r
    Contributor

    Duplicate of #87. The driver's default max packet size is now 64 MiB (go-sql-driver v1.7.1); byte-aware batch sizing is tracked there.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions