Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions db/indices.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,13 +514,15 @@ int add_record_indices(struct ireq *iq, void *trans, blob_buffer_t *blobs,
goto done;
} else if (rc != 0) {
*ixfailnum = ixnum;
/* If following changes, update OSQL_INSREC in osqlcomm.c */
*opfailcode = OP_FAILED_UNIQ; /* really? */

// If this transaction has already added this key and adding this key again
// violates a duplicate key constraint, then this txn is uncommittable.
if (dup_txn_insert == 1) {
iq->dup_key_insert = 1;
if (rc == IX_DUP) {
*opfailcode = OP_FAILED_UNIQ;
// If this transaction has already added this key and adding this key again
// violates a duplicate key constraint, then this txn is uncommittable.
if (dup_txn_insert) {
iq->dup_key_insert = 1;
}
} else {
*opfailcode = OP_FAILED_INTERNAL;
}

ERR(rc, "add error", 0);
Expand Down
1 change: 1 addition & 0 deletions db/osqlblockproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,7 @@ static int apply_changes(struct ireq *iq, blocksql_tran_t *tran, void *iq_tran,

if (iq->vfy_idx_track) {
hash_clear(iq->vfy_idx_hash);
iq->dup_key_insert = 0;
}

/* create a cursor */
Expand Down
Loading