0004-auditor_purse_not_closed_inconsistencies.sql (1309B)
1 -- 2 -- This file is part of TALER 3 -- Copyright (C) 2026 Taler Systems SA 4 -- 5 -- TALER is free software; you can redistribute it and/or modify it under the 6 -- terms of the GNU General Public License as published by the Free Software 7 -- Foundation; either version 3, or (at your option) any later version. 8 -- 9 -- TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 -- A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 -- 13 -- You should have received a copy of the GNU General Public License along with 14 -- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 -- 16 17 -- handle_purse_expired() re-reports every expired purse on every auditor 18 -- round and the INSERT had no dedup, so the table grew by one row per 19 -- purse per round for the ten years until GC removes the purse. Keep 20 -- one report per purse. 21 DELETE FROM auditor_purse_not_closed_inconsistencies pnc 22 WHERE pnc.row_id < 23 (SELECT MAX(pnc2.row_id) 24 FROM auditor_purse_not_closed_inconsistencies pnc2 25 WHERE pnc2.purse_pub=pnc.purse_pub); 26 27 ALTER TABLE auditor_purse_not_closed_inconsistencies 28 ADD CONSTRAINT auditor_purse_not_closed_inconsistencies_purse_pub_key 29 UNIQUE (purse_pub);