Projet

Général

Profil

Actions

Anomalie #1667

fermé

SQL error on getChartContribsAllTime() with MySQL

Ajouté par Guillaume AGNIERAY il y a environ un an. Mis à jour il y a 8 mois.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
Core
Version cible:
-
Début:
23/02/2023
Echéance:
% réalisé:

100%

Temps estimé:
Version utilisée:

Description

MySQL has a default SQL mode enabled (only_full_group_by) which causes the error below on the charts page.
https://dev.mysql.com/doc/refman/8.0/en/group-by-handling.html
source:/galette/lib/Galette/IO/Charts.php@develop#L376


Détails
Type : PDOException

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

Fichier : C:\laragon\www\galette-dev\galette\vendor\laminas\laminas-db\src\Adapter\Driver\Pdo\Connection.php

Ligne : 376

Trace
#0 C:\laragon\www\galette-dev\galette\vendor\laminas\laminas-db\src\Adapter\Driver\Pdo\Connection.php(376): PDO->query('SELECT date_for...')
#1 C:\laragon\www\galette-dev\galette\vendor\laminas\laminas-db\src\Adapter\Adapter.php(194): Laminas\Db\Adapter\Driver\Pdo\Connection->execute('SELECT date_for...')
#2 C:\laragon\www\galette-dev\galette\lib\Galette\Core\Db.php(788): Laminas\Db\Adapter\Adapter->query('SELECT date_for...', 'execute')
#3 C:\laragon\www\galette-dev\galette\lib\Galette\IO\Charts.php(383): Galette\Core\Db->execute(Object(Laminas\Db\Sql\Select))
#4 C:\laragon\www\galette-dev\galette\lib\Galette\IO\Charts.php(100): Galette\IO\Charts->getChartContribsAllTime() 
[...]

Demandes liées 1 (0 ouverte1 fermée)

Duplique Galette - Anomalie #1219: Erreur MySQL quand on se rend dans le menu GraphiqueFerméJohan Cwiklinski07/12/2018

Actions

Mis à jour par Johan Cwiklinski il y a environ un an

  • Duplique Anomalie #1219: Erreur MySQL quand on se rend dans le menu Graphique ajouté

Mis à jour par Johan Cwiklinski il y a environ un an

I cannot test right now, but would it be possible replacing the group clause with the selected column solves the issue?

$cols['date'] = new Expression('date_format(date_enreg, \'%Y-%m\')');
$groupby = new Expression('date_format(date_enreg, \'%Y-%m\')');

I cannot remember why those are same for postgres but not for mysql.

Mis à jour par Guillaume AGNIERAY il y a environ un an

Johan Cwiklinski a écrit (#note-2):

would it be possible replacing the group clause with the selected column solves the issue?

Yes it does ! :)

Mis à jour par Anonyme il y a environ un an

  • Statut changé de Nouveau à Résolu
  • % réalisé changé de 0 à 100

Mis à jour par Johan Cwiklinski il y a 8 mois

  • Statut changé de Résolu à Fermé
Actions

Formats disponibles : Atom PDF