Hallo,
Hatte ebenfalls den Fehler "ERROR 1062 (23000) at line 187: Duplicate
entry 'xxxx-Seen-x' for key 'ticket_flag_per_user'"
In Rudolfs Beitrag haben wir schon gesehen, dass man die betreffenden
Zeilen so finden kann um sie dann zu löschen:
SELECT ticket_id,ticket_key,create_by FROM `otrs`.`ticket_flag` group
by ticket_id,ticket_key,create_by having count(*)>1;
Da der Löschbefehl in diesem Fall gar nicht so trivial ist, möchte ich
ihn hier gleich mal posten:
Es lag nahe, den Befehl von Rudolf einfach in ein "DELETE FROM WHERE id
in ()" einzubauen - aber siehe da das ergibt einen Fehler:
DELETE
FROM ticket_flag
WHERE ticket_id IN (
SELECT ticket_id FROM ticket_flag
GROUP BY ticket_id, ticket_key, create_by
HAVING count(*) >1
)
#1093 - You can't specify target table 'ticket_flag' for update in FROM
clause
Mit einem Trick gehts dann aber doch:
DELETE
FROM ticket_flag
WHERE ticket_id IN (
SELECT ticket_id FROM (
SELECT ticket_id
FROM ticket_flag
GROUP BY
ticket_id, ticket_key, create_by
HAVING count(*) >1
)
AS newtable
)
(Quelle: http://bugs.mysql.com/bug.php?id=5037)
Danach kann man die betreffende Zeile auch gleich noch mal ausführen:
ALTER TABLE ticket_flag ADD CONSTRAINT ticket_flag_per_user UNIQUE
INDEX (ticket_id, ticket_key, create_by);
Das Script muss man danach nicht nochmal ausführen.
LG Fritz
Am 16.03.2012 10:41, schrieb Rudolf Bargholz:
Hallo Christian,
Die Zeilennummer des Fehlers im DB-Update-Skript
DBUpdate-to-3.1.mysql.sql
wurde angezeigt: 187
Habe mir diese Zeile angeschaut:
ALTER TABLE ticket_flag ADD CONSTRAINT ticket_flag_per_user UNIQUE_INDEX
(ticket_id, ticket_key, create_by);
MYSQL Workbench aufgemacht und mich auf die DB angemeldet, dann folgendes SQL
ausgeführt:
SELECT ticket_id,ticket_key,create_by FROM `otrs`.`ticket_flag` group by
ticket_id,ticket_key,create_by having count(*)>1;
Dies gab mir die Schuldigen zurück. Habe diese einfach gelöscht. Wollte mir
nicht die Arbeit machen die Duplikate zu entfernen, obwohl dies ohne zu viel
Aufwand auch machbar gewesen wäre.
Reichen dir diese Angaben?
Gruss
Rudolf
-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von
Christian Mlynarek
Gesendet: Donnerstag, 15. März 2012 16:47
An: User questions and discussions about OTRS.org in German
Betreff: Re: [otrs-de] Success upgrading from 3.0.11 to 3.1.2
Hi Rudolf,
thanks a lot for sharing!
I have a question.
how did you find the dublicates in the "ticket_flag" table?
Regards,
Christian
Am 06.03.2012 18:41, schrieb Rudolf Bargholz:
Hi,
This forum is mostly filled with problems, so I thought it might be a
change to report something working flawlessly:
Just followed the steps for upgrading OTRS HelpDesk on Suse Linux 10
from 3.0.11 to 3.1.2, followed every step in the UPGRADING file, found
duplicate rows in the ticket_flag table, removed these, re-ran the pre
MySql DB update script, everything went fine, completed the update,
updated the packages we use, and everything just worked. The new
version is really much faster than the previous versions.
A big thank you to the OTRS developers/committers.
Regards
Rudolf Bargholz
---------------------------------------------------------------------
OTRS mailing list: otrs-de - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs-de
To unsubscribe: http://lists.otrs.org/mailman/listinfo/otrs-de