hschottm / tags

Contao tags extension
11 stars 16 forks source link

Fehler: Große Tagsanzahl verursacht Fehler #42

Open jankout opened 6 years ago

jankout commented 6 years ago

Hallo Helmut,

mir scheint es, dass zu viele Tags in der Tabelle folgenden Fehler verursachen, sodass die Newsdetailseite nicht gezeigt wird. Oder muss ich etwas im News-full-Template anpassen?

Wenn ich die Tags bei den Newsbeiträgen rausnehme, geht es wieder.

Schon jetzt danke ich dir für deinen Ratschlag.

cadus-org-tags

[2018-05-30 18:07:32] app.CRITICAL: An exception occurred. {"exception":"[object] (Doctrine\\DBAL\\Exception\\DriverException(code: 0): An exception occurred while executing 'SELECT * FROM\n\t\t\t(\n \n\t\t\t\t(\n\t\t\t\t\tSELECT n.*, count(t.id) AS count_tags, 1 AS type \n\t\t\t\t\tFROM tl_news n\n\t\t\t\t\tLEFT JOIN tl_tag t\n\t\t\t\t\t\tON n.id = t.tid\n\t\t\t\t\t\n\t\t\t\t\tWHERE n.pid IN(4,5)\n\t\t\t\t\t\tAND (t.tag IN('AERU','Airborne','Cadus','Emergency Response'))\n\t\t\t\t\t\t\n\t\t\t\t\t\tAND n.id!='450'\n\t\t\t\t\t\t\tAND (n.start = '' OR n.start < '1527696452') AND (n.stop = '' OR n.stop > '1527696452') AND n.published = 1\n\t\t\t\t\tGROUP BY n.id\n\t\t\t\t\tORDER BY count_tags DESC, n.date DESC\n\t\t\t\t\tLIMIT 0\n\t\t\t\t)\n\t\t\t\t\n \n \n \n\t\t\t\tUNION\n\t\t\t\t\n \n\t\t\t\t(\n\t\t\t\t\tSELECT n.*, 0 AS count_tags, 3 AS type \n\t\t\t\t\tFROM tl_news n\n\t\t\t\t\t\n\t\t\t\t\tWHERE n.pid='4'\n\t \n\t\t\t\t\t\tAND n.id!='450'\n\t\t\t\t\t\t AND (n.start = '' OR n.start < '1527696452') AND (n.stop = '' OR n.stop > '1527696452') AND n.published = 1\n\t\t\t\t\tORDER BY n.date DESC\n\t\t\t\t\tLIMIT 0\n\t\t\t\t)\n\t\t\t\t\n\t\t\t)\n\t\t\tAS n\n\t\t\tGROUP BY n.id\n\t\t\tORDER BY n.type ASC,n.count_tags DESC,n.date DESC\n\t\t\tLIMIT 0':\n\nSQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'n.pid' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at /var/www/cadus.org/contao4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:125, Doctrine\\DBAL\\Driver\\PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'n.pid' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at /var/www/cadus.org/contao4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:109, PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'n.pid' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at /var/www/cadus.org/contao4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:107)"} []

hschottm commented 6 years ago

Also der Fehler kommt, weil die SQL-Abfrage falsch ist. Die Frage ist, woher kommt diese Abfrage? Von mir stammt die nicht, so komplexe Abfragen habe ich nicht im tags-Modul. Ich habe keine Idee, woher diese Abfrage kommen könnte. Welches Modul führt denn dazu, dass der Fehler auftritt?

Sioweb commented 4 years ago

Tag zusammen,

der Fehler hängt mit der Mysql-Version zusammen und nicht zwangsläufig mit dem Modul: sql_mode=only_full_group_by.

Die Meldung kann mit einem SQL-Query entfernt werden:

SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));