• Aleksey Midenkov's avatar
    MDEV-23644 Assertion on evaluating foreign referential action for... · 932ec586
    Aleksey Midenkov authored
    MDEV-23644 Assertion on evaluating foreign referential action for self-reference in system versioned table
    
    First part of the fix (row0mysql.cc) addresses external columns when adding history
    row on referential action. The full data must be retrieved before the
    row is inserted.
    
    Second part of the fix (the rest) avoids duplicate primary key error between
    the history row generated on referential action and the history row
    generated by SQL command. Both command and referential action can
    happen on same table since foreign key can be self-reference (parent
    and child tables are same). Moreover, the self-reference can refer
    multiple rows when the key is non-unique. In such case history is
    generated by referential action occured on first row but processed all
    rows by a matched key. The second round is when the next row is
    processed by a command but history already exists. In such case we
    check TRX_ID of existing history row and if it is the same we assume
    the above situation and skip adding one more history row or failing
    the command.
    932ec586
delete.result 3.47 KB