ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: siprof on May 03, 2017, 06:26:11 pm

Title: MySQL strict mode
Post by: siprof on May 03, 2017, 06:26:11 pm
Hi,

I encountered this error while trying to open Sent Items
Code: [Select]
Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'databasename.pm.id_pm' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
File: /srv/users/serverpilot/apps/appname/public/sources/subs/PersonalMessage.subs.php
Line: 1034

Note: Your database version is 1.0.10.

after a litte search I found that I must disable MySQL strict mode (https://serverpilot.io/community/articles/how-to-disable-strict-mode-in-mysql-5-7.html) on my serverpilot's VPS

AFAIK MySQL strict mode was enabled by default since MySQL 5.7, should Elkarte aware of this?

Regards,
Lukas
Title: Re: MySQL strict mode
Post by: emanuele on May 03, 2017, 06:36:25 pm
Try replacing the:
Code: [Select]
'sort' => $pm_options['sort_by_query'],
of the query, with:
Code: [Select]
'sort' => $pm_options['sort_by_query'] === 'pm.id_pm' ? 'MAX(pm.id_pm)' : $pm_options['sort_by_query'],
Title: Re: MySQL strict mode
Post by: siprof on May 04, 2017, 02:52:52 am
Done
Nice to know, reenabled MySQL strict mode now...
Thanks
Title: Re: MySQL strict mode
Post by: emanuele on May 04, 2017, 02:57:13 am
Let me know if it works! :)
Title: Re: MySQL strict mode
Post by: radu81 on May 04, 2017, 05:03:10 am
Something similar was already reported here http://www.elkarte.net/community/index.php?topic=4185.0
Title: Re: MySQL strict mode
Post by: siprof on May 04, 2017, 06:19:48 am
it works :)


Quote from: radu81 – Something similar was already reported here http://www.elkarte.net/community/index.php?topic=4185.0
you're right it's similar, I wonder why I did not see your thread at first search...  :-*
Title: Re: MySQL strict mode
Post by: emanuele on May 04, 2017, 06:40:42 am
Tracked https://github.com/elkarte/Elkarte/issues/2926