You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2019-06-27 12:29:58

Auroch2.0
Member
Registered: 2011-10-26
Posts: 5

SQL syntaxe error sur GLPI v9.4.2

GLPI version 9.4.2 (migré de 0.82)

glpisqllog.ERROR: DBmysql::query() in /var/www/glpi/helldesk/inc/dbmysql.class.php line 177
  *** MySQL query error:
  SQL: SELECT `glpi_users`.`id` AS `users_id`, `glpi_users`.`1`, `glpi_users`.`language` AS `language`, `glpi_tickets_users`.`use_notification` AS `notif`, `glpi_tickets_users`.`alternative_email` AS `altemail` FROM `glpi_tickets_users` LEFT JOIN `glpi_users` ON (`glpi_tickets_users`.`users_id` = `glpi_users`.`id`) INNER JOIN `glpi_profiles_users` ON (`glpi_profiles_users`.`users_id` = `glpi_users`.`id` glpi_profiles_users.entities_id 3) WHERE `glpi_tickets_users`.`tickets_id` = '5756' AND `glpi_tickets_users`.`type` = '2' AND `glpi_tickets_users`.`users_id` = '1529'
  Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'glpi_profiles_users.entities_id 3) WHERE `glpi_tickets_users`.`tickets_id` = '57' at line 1
  Backtrace :
  inc/dbmysqliterator.class.php:95                   
  inc/dbmysql.class.php:569                          DBmysqlIterator->execute()
  plugins/behaviors/inc/ticket.class.php:188         DBmysql->request()
  plugins/behaviors/inc/ticket.class.php:98          PluginBehaviorsTicket::getLastLinkedUserByType()
  inc/plugin.class.php:1112                          PluginBehaviorsTicket::addActionTargets()
  inc/notificationtarget.class.php:1148              Plugin::doHook()
  inc/notificationeventabstract.class.php:91         NotificationTarget->addForTarget()
  inc/notificationevent.class.php:163                NotificationEventAbstract::raise()
  inc/commonitilactor.class.php:408                  NotificationEvent::raiseEvent()
  inc/ticket_user.class.php:59                       CommonITILActor->post_addItem()
  inc/commondbtm.class.php:1142                      Ticket_User->post_addItem()
  inc/commonitilobject.class.php:820                 CommonDBTM->add()
  inc/ticket.class.php:1306                          CommonITILObject->prepareInputForUpdate()
  inc/commondbtm.class.php:1363                      Ticket->prepareInputForUpdate()
  front/ticket.form.php:72                           CommonDBTM->update()
  {"user":"2@helldesk"} 

Et en effet, la partie finale de cette query semble bien avoir un problème de syntaxe :

... INNER JOIN `glpi_profiles_users` ON (`glpi_profiles_users`.`users_id` = `glpi_users`.`id` glpi_profiles_users.entities_id 3) ...

De plus, en début de requête, la partie `glpi_users`.`1` ne correspond à aucune table.

Si je converti la requête de la façon suivante :

SELECT `glpi_users`.`id` AS `users_id`, `glpi_users`.`id`, `glpi_users`.`language` AS `language`, `glpi_tickets_users`.`use_notification` AS `notif`, `glpi_tickets_users`.`alternative_email` AS `altemail` FROM `glpi_tickets_users` LEFT JOIN `glpi_users` ON (`glpi_tickets_users`.`users_id` = `glpi_users`.`id`) INNER JOIN `glpi_profiles_users` ON (`glpi_profiles_users`.`users_id` = `glpi_users`.`id` AND `glpi_profiles_users`.`entities_id` = '3') WHERE `glpi_tickets_users`.`tickets_id` = '5756' AND `glpi_tickets_users`.`type` = '2' AND `glpi_tickets_users`.`users_id` = '1569'

J'obtiens par contre une réponse qui correspond à :

users_id    id    language    notif    altemail
1569    1569    NULL    1    prenom.nom@anonymisation.xy
1569    1569    NULL    1    prenom.nom@anonymisation.xy

Il semble donc bien qu'il y a ait deux problèmes dans cette requête générée par GLPI ... (Syntaxe pure et référence de champs)
Ce GLPI est utilisé depuis 2013 et de migration en migration, nous sommes à présent à la version 9.4.2.
Le problème ne semblait pas se poser (au regard du seul log dont je dispose encore) à la version précédente (0.84)

Une idée, une piste de solution, un truc que j'aurais loupé lors de la migration ?
(NB: les tables sont toutes en innodb)

Offline

#2 2019-07-01 09:23:05

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,273

Re: SQL syntaxe error sur GLPI v9.4.2

C'est un problème du plugin Behaviors : https://forge.glpi-project.org/issues/5584
Je déplace dans la bonne section


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#3 2019-07-01 09:47:29

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,273

Re: SQL syntaxe error sur GLPI v9.4.2

Merci de la remontée d'erreur. Corrigée : https://forge.glpi-project.org/projects … isions/290


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#4 2019-07-04 10:55:07

Auroch2.0
Member
Registered: 2011-10-26
Posts: 5

Re: SQL syntaxe error sur GLPI v9.4.2

Pas de problème, merci pour le retour et l'action super rapide !

Offline

#5 2019-09-23 18:45:01

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,273

Re: SQL syntaxe error sur GLPI v9.4.2

Nouvelle version publiée ce jour : https://forge.glpi-project.org/news/399


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

Board footer

Powered by FluxBB