Documentation
Getting Started
Data Grid
Modeling
Business Rules
Approvals
Users, Roles & Security
Administration
Integration & API
Installation
Migrating from MDS

DBA Reference

When a row is stuck in a locked state because of a pending approval, a database administrator can clear it with the queries below.

Prefer the soft cancel in production. It preserves the audit trail.

1. Find the pending (locked) approval requests

SELECT
    ar.Id,
    ar.Status,
    ar.SubmittedAt,
    e.Name         AS Entity,
    u.DisplayName  AS SubmittedBy,
    COUNT(arow.Id) AS LockedRows
FROM ApprovalRequests ar
JOIN Entities e  ON ar.EntityId = e.Id
JOIN Users u     ON ar.SubmittedByUserId = u.Id
LEFT JOIN ApprovalRows arow
    ON arow.ApprovalRequestId = ar.Id AND arow.RowStatus = 'pending'
WHERE ar.Status = 'pending'
GROUP BY ar.Id, ar.Status, ar.SubmittedAt, e.Name, u.DisplayName
ORDER BY ar.SubmittedAt DESC;

2. Inspect the locked rows in one request

SELECT
    arow.Id,
    arow.EntityRowId,
    arow.Operation,
    arow.RowStatus,
    arow.RowCode,
    arow.SnapshotData
FROM ApprovalRows arow
WHERE arow.ApprovalRequestId = 123  -- replace with the Id from step 1
  AND arow.RowStatus = 'pending';

This sets the request to cancelled and marks each pending row rejected. The row unlocks on the next grid load. All history is kept.

UPDATE ApprovalRequests
SET    Status = 'cancelled', ModifiedAt = GETUTCDATE()
WHERE  Id = 123;                   -- replace with the request Id from step 1

UPDATE ApprovalRows
SET    RowStatus = 'rejected'
WHERE  ApprovalRequestId = 123 AND RowStatus = 'pending';

3b. Hard delete — removes all traces

ApprovalRows and ApprovalReviews cascade-delete automatically. Use this for test or demo data only.

DELETE FROM ApprovalRequests WHERE Id = 123;

Impact on records

Soft cancelHard delete
ApprovalRequestsPreserved — Status becomes cancelledDeleted
ApprovalRows and SnapshotDataPreserved — RowStatus becomes rejectedCascade deleted
ApprovalReviews (reviewer comments)PreservedCascade deleted
Live entity data (EntityRows)UnchangedUnchanged

Impact on auditing

The AuditLog table is written only when an approval is successfully approved. A pending request that is cancelled or deleted before approval has no audit entry, because the changes were never promoted to live data.

Soft cancelHard delete
Audit log entriesNone added or removedNone added or removed
Approval history visibleYes — the request shows as cancelledNo — every trace is removed
Reviewer comments visibleYes — kept in ApprovalReviewsNo — cascade deleted
After either operation the locked row unlocks as soon as the grid reloads. Neither operation changes live entity data.

Ready to get started?

Start managing your master data with Primentra today.

View Pricing
DBA Reference | Architecture | Docs | Primentra