Project

General

Profile

Actions

Fehler #483

closed

Upgrade-Skript: delete_cvars_on_trans_deletion_add_shipto löscht alle custom_variables

Added by Jan Büren over 3 years ago. Updated over 3 years 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

Actions #1

Updated by Jan Büren over 3 years 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));

Actions #2

Updated by Jan Büren over 3 years 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

Actions #3

Updated by Jan Büren over 3 years 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)
Actions #4

Updated by Jan Büren over 3 years ago

  • Status changed from Neu to Gelöst

In Version 3.5.8 gelöst

Actions

Also available in: Atom PDF