Erreur Migration v20.0.4 --> v21.0.0

Bonjour tout le monde,

La migration de la version v20.0.4 vers la v21.0.0 s’est soldée par 2 erreurs dans le script SQL de la MAJ. Voir ci-après.

OS: Rocky Linux 9.5
DB: PostgreSQL 16

Merci d’avance,
Samir

Error DB_ERROR_SYNTAX (Req 94): UPDATE llx_category_bankline AS bl INNER JOIN llx_category_bank AS b ON bl.fk_categ = b.rowid INNER JOIN llx_categorie AS c ON b.label = c.label AND b.entity = c.entity AND c.type = 8 SET bl.fk_categ = c.rowid WHERE c.rowid IS NOT NULL;
ERROR: 42601: syntax error at or near « INNER » LINE 1: UPDATE llx_category_bankline AS bl INNER JOIN llx_category_b… ^ LOCATION: scanner_yyerror, scan.l:1244

Error DB_ERROR_SYNTAX (Req 96): UPDATE llx_category_bankline AS bl INNER JOIN llx_bank_categ AS b ON bl.fk_categ = b.rowid INNER JOIN llx_categorie AS c ON b.label = c.label AND b.entity = c.entity AND c.type = 8 SET bl.fk_categ = c.rowid WHERE c.rowid IS NOT NULL;
ERROR: 42601: syntax error at or near « INNER » LINE 1: UPDATE llx_category_bankline AS bl INNER JOIN llx_bank_categ… ^ LOCATION: scanner_yyerror, scan.l:1244

Utilisais tu les categories au niveau des lignes de transaction bancaires ? Si non, tu peux ignorer.

Si non, essaie une des 2 requetes suivantes

UPDATE llx_category_bankline AS bl
SET fk_categ = c.rowid
FROM llx_category_bank AS b
INNER JOIN llx_categorie AS c
ON b.label = c.label
AND b.entity IS NOT NULL
AND c.type = 8
WHERE bl.fk_categ = b.rowid
AND c.rowid IS NOT NULL;

ou

UPDATE llx_category_bankline AS bl
SET fk_categ = c.rowid
FROM llx_bank_categ AS b
INNER JOIN llx_categorie AS c
ON b.label = c.label
AND b.entity IS NOT NULL
AND c.type = 8
WHERE bl.fk_categ = b.rowid
AND c.rowid IS NOT NULL;

Tant que le sujet est là, j’en profite pour signaler ce bug:

2025-03-05 20:58:23 NOTICE  100.115.92.25      2865     33 --- Access to GET /dolibarr_21/htdocs/product/list.php - action=, massaction=
2025-03-05 20:58:23 ERR     100.115.92.25      2865     33 DoliDBMysqli::query Exception in query instead of returning an error: 'dolibarr_21.p.ref_ext' isn't in GROUP BY
2025-03-05 20:58:23 ERR     100.115.92.25      2865     33 DoliDBMysqli::query SQL Error query: SELECT p.rowid, p.ref, p.ref_ext, p.description, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity, p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.tobatch,  p.fk_default_workstation, ws.status as status_workstation, ws.ref as ref_workstation,  p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.datec as date_creation, p.tms as date_modification, p.pmp, p.stock, p.cost_price, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.fk_country, p.fk_state, p.import_key, MIN(pfp.unitprice) as bestpurchaseprice, pac.rowid as prod_comb_id, pac.fk_product_parent FROM llx_product as p LEFT JOIN llx_workstation_workstation as ws ON (p.fk_default_workstation = ws.rowid) LEFT JOIN llx_product_fournisseur_price as pfp ON p.rowid = pfp.fk_product LEFT JOIN llx_product_attribute_combination pac ON pac.fk_product_child = p.rowid WHERE p.entity IN (1) AND p.fk_product_type <> 1 AND pac.rowid IS NULL GROUP BY p.rowid, p.ref, p.description, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.datec, p.tms, p.entity, p.tobatch, p.pmp, p.cost_price, p.stock, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.fk_country, p.fk_state, p.import_key, p.fk_default_workstation, ws.status, ws.ref, pac.rowid, pac.fk_product_parent ORDER BY p.ref ASC LIMIT 21
2025-03-05 20:58:23 ERR     100.115.92.25      2865     33 DoliDBMysqli::query SQL Error message: DB_ERROR_1055 'dolibarr_21.p.ref_ext' isn't in GROUP BY From /home/xxxxxx/www/dolibarr_21/htdocs/product/list.php:722.

Merci @eldy
Non je ne les utilise pas.
Je préfère toutefois attendre que le script soit corrigé pour ne pas en avoir des tables non conformes au cas où.
Bon courage :slight_smile: