Shouldn't YEARWEEK() use the variable's value if none is provided or am I wrong in that regard?
No.
While I understand the argument, this is documented and therefore expected behavior. From the docs on default_week_format
:
The default mode value to use for the
WEEK()
function.
So this system variable is only used for WEEK()
. However, as you noted, both functions allow week_format
as a second argument. As such, I would encourage you not to set this at the server level, but in your code for clarity.