Hi, I'm using triggers and encounter an "internal error" that times out after 30 seconds when the ab

Hi, I'm using triggers and encounter an "internal error" that times out after 30 seconds when the abort occurs. It's not a massive problem, but it would be nice if this was fixed.

The trigger:
CREATE TRIGGER deduct_coins_on_consumable
BEFORE INSERT ON ActiveConsumables
  BEGIN
    UPDATE accounts
    SET pseudoCoins = pseudoCoins - (SELECT cost FROM Consumables WHERE id = NEW.consumableId)
    WHERE
      id = NEW.accountId 
        AND
      pseudoCoins >= (SELECT cost FROM Consumables WHERE id = NEW.consumableId);

  SELECT RAISE(ROLLBACK, 'Insufficient coins') WHERE changes() = 0;
END


the internal error occurs when coins < cost.

"database_name": "discord-oauth",
"database_id": "2bd61136-7eb6-4b5d-82ce-f3405294398d"
Was this page helpful?