title: sqlite constraint failed error code
body: <p>I have two tables albums and songs and each song has reference to alum's id.</p>
  
  <p>Album table :</p>
  
  <pre><code>CREATE TABLE albums
  (id INTEGER PRIMARY KEY ASC,
  name TEXT,
  additional TEXT)
  </code></pre>
  
  <p>Song table:</p>
  
  <pre><code>CREATE TABLE songs
  (id INTEGER PRIMARY KEY ASC,
  album_fk INTEGER NOT NULL,
  title TEXT,
  url TEXT,
  duration BIGINT NOT NULL)
  </code></pre>
  
  <p>and i also have a trigger to check when i delete an album if there are existing songs in it :</p>
  
  <pre><code>CREATE TRIGGER trigger_on_delete
  BEFORE DELETE ON albums
  FOR EACH ROW BEGIN
  SELECT RAISE(FAIL,'album has songs cannot be deleted')
  WHERE (SELECT album_fk FROM songs WHERE album_fk = OLD.id) IS NOT
  NULL;)
  END
  </code></pre>
  
  <p>all this is working fine but sometimes </p>
  
  <pre><code>Exception: android.database.sqlite.SQLiteConstraintException: error
  code 19: constraint failed
  Stack Trace :
  android.database.sqlite.SQLiteStatement.native_execute(Native Method)
  android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:
  66)
  </code></pre>
  
  <p>is thrown when i try to delete an album. My delete method is simply deleting an album by id.The bad thing is that i can't reproduce this so there is no much info i can provide. 
  I tried different scenarios with deleting an album but i never got this exception.</p>
  
  <p>So any ideas how can investigate this issue. There are not any contraints in album table so what could cause such exception ? Any help will be appreciated.</p>