Modify ↓
#11253 closed defect (fixed)
[patch] model.py/save(): INSERT INTO ticket_custom actually never called
Reported by: | lostpoint | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | MasterTicketsPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: |
Description (last modified by )
from model.py
:
cursor.execute('UPDATE ticket_custom SET value=%s WHERE ticket=%s AND name=%s', (new_value, n, field)) # refresh the changetime to prevent concurrent edits cursor.execute('UPDATE ticket SET changetime=%s WHERE id=%s', (when_ts, n)) if not cursor.rowcount: cursor.execute('INSERT INTO ticket_custom (ticket, name, value) VALUES (%s, %s, %s)', (n, field, new_value))
Since there is UPDATE ticket" between "UPDATE ticket_custom
and if not cursor.rowcount
, INSERT INTO ticket_custom
is actually never called, because UPDATE ticket
is always OK, no matter if UPDATE ticket_custom
completed successfully or there is no such record.
Got this issue on a legacy database where tickets do not have corresponding ticket_custom values for blockedby
and blocked
.
I did a patch for this issue, you just have to move UPDATE ticket
below if not cursor.rowcount - INSERT INTO ticket custom
block.
Attachments (1)
Change History (5)
Changed 11 years ago by
Attachment: | ticket_custom.patch added |
---|
comment:1 Changed 11 years ago by
Description: | modified (diff) |
---|---|
Status: | new → accepted |
comment:2 Changed 11 years ago by
Status: | accepted → assigned |
---|
comment:3 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:4 Changed 8 years ago by
Note: See
TracTickets for help on using
tickets.
In 16039: