You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 codeMaxAllowedPacket 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
driv3r commentedon Oct 14, 2026
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.