Project

General

Profile

Actions

Bug(バグ) #4155

open

OpenPNE 3 - Task(タスク) #4033: MySQLのStrict Modeを有効にした場合に生じる問題を調査

MySQLのONLY_FULL_GROUP_BYが有効な状態でコミュニティ盛り上がり度ランキング画面を表示するとエラー

Added by Youichi Kimura almost 8 years ago.

Status:
New(新規)
Priority:
Normal(通常)
Assignee:
-
Start date:
2017-02-16
Due date:
% Done:

0%

Estimated time:
3.6 で発生するか:
Unknown (未調査)
[QA]バグ通知済:
No
3.8 で発生するか:
Unknown (未調査)

Description

Overview (概要)

MySQL 5.7 の Strict Mode が有効な状態での動作確認 (#4033) を行った際に発生した。

コミュニティ盛り上がり度ランキング画面を開くと下記のエラーが発生する:

SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'openpne.c.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Causes (原因)

SELECT c.id AS c__id, c2.id AS c2__id, c2.community_id AS c2__1, COUNT(*) AS c__0, c2.community_id AS c2__1
  FROM community_topic_comment c
  LEFT JOIN community_topic c2 ON c.community_topic_id = c2.id
 WHERE (c.created_at >= '2017-02-15' AND c.created_at < '2017-02-16')
 GROUP BY c2.community_id
 ORDER BY COUNT(*) DESC
 LIMIT 10

上記のクエリで、c.id が GROUP BY に含まれていないためエラーが発生している。

Way to fix (修正内容)

修正内容を記入

No data to display

Actions

Also available in: Atom PDF