Project

General

Profile

Fehler #483

Upgrade-Skript: delete_cvars_on_trans_deletion_add_shipto löscht alle custom_variables

Added by Jan Büren about 2 months ago. Updated about 2 months ago.

Status:
Gelöst
Priority:
Sofort
Assignee:
-
Target version:
-
Start date:
08/09/2021
Due date:
% Done:

0%

Estimated time:

Description

Vorher:


# select count(*) from custom_variables;
 count  
--------
 669451

Eigentlich sollten nur die weg:

  1. (SELECT cv.id FROM custom_variables cv LEFT JOIN custom_variable_configs cvc ON (cv.config_id = cvc.id)
  2. WHERE module LIKE 'ShipTo'
  3. AND NOT EXISTS (SELECT shipto_id FROM shipto WHERE shipto_id = cv.trans_id));

(688 rows)

In Kombination mit dem DELETE werden aber alle Einträge gelöscht:

  1. DELETE FROM custom_variables WHERE EXISTS
  2. (SELECT cv.id FROM custom_variables cv LEFT JOIN custom_variable_configs cvc ON (cv.config_id = cvc.id)
  3. WHERE module LIKE 'ShipTo'
  4. AND NOT EXISTS (SELECT shipto_id FROM shipto WHERE shipto_id = cv.trans_id));
    DELETE 669451

WHERE EXISTS is nur ein Boolean-Wert, d.h. sollte irgendein verwaister ShipTo Eintrag vorhanden sein, entferne einfache alle BDVs

S.a.:
https://www.postgresql.org/docs/8.1/functions-subquery.html

History

#1

Updated by Jan Büren about 2 months ago

Damit passt es:


select count (*) from custom_variables where id in (SELECT cv.id FROM custom_variables cv LEFT JOIN custom_variable_configs cvc ON (cv.config_id = cvc.id)
   WHERE module LIKE 'ShipTo'
     AND NOT EXISTS (SELECT shipto_id FROM shipto WHERE shipto_id = cv.trans_id));

#2

Updated by Jan Büren about 2 months ago

  • Priority changed from Normal to Sofort

Das ist ein kritischer und etwas subtiler Bug und betrifft das aktuelle Release.

Vorschlag: 3.5.8 zeitnah veröffentlichen

#3

Updated by Jan Büren about 2 months ago

Mit Commit #dc59476f, wird es dann besser gemacht.

Vorher:


# select count(*) from custom_variables;
 count  
--------
 671796
(1 row)

Nachher:

# select count(*) from custom_variables;
 count  
--------
 671108
(1 row)
#4

Updated by Jan Büren about 2 months ago

  • Status changed from Neu to Gelöst

In Version 3.5.8 gelöst

Also available in: Atom PDF