Skip to content

Commit ff83ffc

Browse files
committed
This should fix bug #9081 : Error creating unique expression index
1 parent d3f717f commit ff83ffc

1 file changed

Lines changed: 17 additions & 14 deletions

File tree

src/jrd/idx.cpp

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,26 @@ class IndexCreateTask : public Task
314314
}
315315

316316
FbLocalStatus status;
317-
if (m_tra)
317+
if (m_tra || m_idx.idx_expression_statement || m_idx.idx_condition_statement)
318318
{
319319
BackgroundContextHolder tdbb(att->att_database, att, &status, FB_FUNCTION);
320-
TRA_commit(tdbb, m_tra, false);
320+
321+
if (m_tra)
322+
TRA_commit(tdbb, m_tra, false);
323+
324+
if (m_idx.idx_expression_statement)
325+
{
326+
m_idx.idx_expression_statement->release(tdbb);
327+
m_idx.idx_expression_statement = NULL;
328+
}
329+
330+
if (m_idx.idx_condition_statement)
331+
{
332+
m_idx.idx_condition_statement->release(tdbb);
333+
m_idx.idx_condition_statement = NULL;
334+
}
321335
}
336+
322337
WorkerAttachment::releaseAttachment(&status, m_attStable);
323338
}
324339

@@ -483,18 +498,6 @@ bool IndexCreateTask::handler(WorkItem& _item)
483498
{
484499
//fb_assert((scb->scb_flags & scb_sorted) == 0);
485500

486-
if (item->m_ownAttach && idx->idx_expression_statement)
487-
{
488-
idx->idx_expression_statement->release(tdbb);
489-
idx->idx_expression_statement = NULL;
490-
}
491-
492-
if (item->m_ownAttach && idx->idx_condition_statement)
493-
{
494-
idx->idx_condition_statement->release(tdbb);
495-
idx->idx_condition_statement = NULL;
496-
}
497-
498501
if (!m_stop && m_creation->duplicates.value() == 0)
499502
scb->sort(tdbb);
500503

0 commit comments

Comments
 (0)