Stored procedure raising “incompatible with sql_mode=only_full_group_by” despite sql_mode being blank

前端 未结 1 1781
春和景丽
春和景丽 2020-12-03 19:12

I have a stored procedure that ran fine on MySQL 5.6. During a recent server migration we upgraded to MySQL 5.7.19.

My stored procedure now throws the error:

相关标签:
1条回答
  • 2020-12-03 19:53

    According to the documentation, MySQL uses the sql mode that was active when you created the procedure:

    MySQL stores the sql_mode system variable setting in effect when a routine is created or altered, and always executes the routine with this setting in force, regardless of the current server SQL mode when the routine begins executing.

    So recreate the procedure (or all, as it might not be the only one affected) with a different mode activated (or fix the group by syntax). Altering the procedure, though mentioned in the documentation, does not suffice. You should consider not to change the sql mode permanently for that (although you might have other incompatible code too).

    0 讨论(0)
提交回复
热议问题