I don't know if it's a problem to mariadb/mysql forum, but, thinking as a product at wordpress, I would check if a know error occurred and retry with a different query just to be sure it is a real error and not a version problem
It's like make a software compatible with postgresql+sql+oracle+mysql+mssql, you should check what query should be used to be sure it's right