Mmctl export create fails with 'Limit exceeded for paging'

Summary

While trying to create an export, mmctl export create fails with:

exportAllPosts: Limit exceeded for paging., failed to find Posts

Steps to reproduce

  1. On the Mattermost server, create an export:
    cd /opt/mattermost/
    bin/mmctl --local export create
    
  2. Check the logs:
    tail -f /opt/mattermost/logs/mattermost.log
    

Mattermost version 10.7.0

Expected behaviour

Create a full export of the server, including messages.

Observed behaviour

No user messages are in the resulting export. The file itself is only 8 kb.

The export job fails with:

{"timestamp":"2025-06-25 14:02:26.690 +01:00","level":"error","msg":"SimpleWorker: job execution error","caller":"jobs/base_workers.go:86","worker_name":"ExportProcess","job_id":"16444px4epretb4b37yeowqsga","job_type":"export_process","job_create_at":"Jun 25 13:02:19.193","error":"exportAllPosts: Limit exceeded for paging., failed to find Posts: Error 1305 (42000): FUNCTION mattermost.JSON_ARRAYAGG does not exist"}

Full log available in the bug report: